[libav-devel] [PATCH] hwaccel: Video Decoder Acceleration (VDA) support

Sebastien Zwickert dilaroga at free.fr
Thu Nov 3 10:28:00 CET 2011


On Nov 2, 2011, at 11:39 PM, Alexander Strange wrote:

> 
> On Nov 2, 2011, at 5:44 PM, Diego Biurrun wrote:
> 
>> From: Sebastien Zwickert <dilaroga at free.fr>
>> 
>> Support h264 accelerated decoding through MacOSX VDA framework
>> 
>> Signed-off-by: Luca Barbato <lu_zero at gentoo.org>
>> Signed-off-by: Diego Biurrun <diego at biurrun.de>
>> ---
>> 
>> +
>> +/* Mutex manager callback. */
>> +static int vda_lock_operation(void **mtx, enum AVLockOp op)
>> +{
>> +    switch (op) {
>> +    case AV_LOCK_CREATE:
>> +        *mtx = av_malloc(sizeof(pthread_mutex_t));
>> +        if (!*mtx)
>> +            return 1;
>> +        return !!pthread_mutex_init(*mtx, NULL);
>> +    case AV_LOCK_OBTAIN:
>> +        return !!pthread_mutex_lock(*mtx);
>> +    case AV_LOCK_RELEASE:
>> +        return !!pthread_mutex_unlock(*mtx);
>> +    case AV_LOCK_DESTROY:
>> +        pthread_mutex_destroy(*mtx);
>> +        av_freep(mtx);
>> +        return 0;
>> +    }
>> +    return 1;
>> +}
> 
> Just use pthread functions directly.
> 
>> […]
>> +/* Decoder callback that adds the vda frame to the queue in display order. */
>> +static void vda_decoder_callback(void *vda_hw_ctx,
>> +                                 CFDictionaryRef user_info,
>> +                                 OSStatus status,
>> +                                 uint32_t infoFlags,
>> +                                 CVImageBufferRef image_buffer)
>> +{
>> +    struct vda_context *vda_ctx = (struct vda_context*)vda_hw_ctx;
>> +    vda_frame *new_frame;
>> +    vda_frame *queue_walker;
>> +
>> +    if (NULL == image_buffer)
>> +        return;
>> +
>> +    if (kCVPixelFormatType_422YpCbCr8 != CVPixelBufferGetPixelFormatType(image_buffer))
>> +        return;
> 
> Shouldn't this return an error?

This is the VDA Decoder callback. 

> I'm not really familiar with hwaccel, but if you can test it it looks OK.

A patch for VLC that uses this hwaccel module is in discussion in videolan ml.

> Of course also make sure to test that it falls back to software decoding on 10bit content.

Please could you provide me a sample of 10bit content ?

Thanks for reviewing.

Best regards,

Sebastien.



More information about the libav-devel mailing list