[FFmpeg-devel] [PATCH 14/14] videotoolbox: remove opengl compatibility attribute

wm4 nfxjfg at googlemail.com
Fri Dec 15 20:52:25 EET 2017


On Fri, 15 Dec 2017 15:02:44 +0800
wbsecg1 at gmail.com wrote:

> From: wang-bin <wbsecg1 at gmail.com>
> 
> 1. a cvpixelbuffer backed by iosurface can always be converted to an opengl texture, using CGLTexImageIOSurface2D for macOS, and undocumented api texImageIOSurface(which is internally used by public api CVOpenGLESTextureCacheCreateTextureFromImage) for iOS4.0+.
> 2. enabling the attribute can slow down decoding speed a lot. I tested many video clips on my macbook air. for example: ffmpeg -ss 00:00:00 -t 00:03:00 -hwaccel videotoolbox -an -i big_buck_bunny_1080p_h264.mov -f null ->/dev/null, result with the attribute
> enabled: frame= 2082 fps= 85 q=-0.0 Lsize=N/A time=00:03:00.00 bitrate=N/A speed=7.34x
> disabled: frame= 2031 fps=104 q=-0.0 Lsize=N/A time=00:03:00.00 bitrate=N/A speed=9.22x
> ---
>  libavcodec/videotoolbox.c | 5 -----
>  1 file changed, 5 deletions(-)
> 
> diff --git a/libavcodec/videotoolbox.c b/libavcodec/videotoolbox.c
> index 9d2f0afa20..24631684d7 100644
> --- a/libavcodec/videotoolbox.c
> +++ b/libavcodec/videotoolbox.c
> @@ -664,11 +664,6 @@ static CFDictionaryRef videotoolbox_buffer_attributes_create(int width,
>      CFDictionarySetValue(buffer_attributes, kCVPixelBufferIOSurfacePropertiesKey, io_surface_properties);
>      CFDictionarySetValue(buffer_attributes, kCVPixelBufferWidthKey, w);
>      CFDictionarySetValue(buffer_attributes, kCVPixelBufferHeightKey, h);
> -#if TARGET_OS_IPHONE
> -    CFDictionarySetValue(buffer_attributes, kCVPixelBufferOpenGLESCompatibilityKey, kCFBooleanTrue);
> -#else
> -    CFDictionarySetValue(buffer_attributes, kCVPixelBufferIOSurfaceOpenGLTextureCompatibilityKey, kCFBooleanTrue);
> -#endif
>  
>      CFRelease(io_surface_properties);
>      CFRelease(cv_pix_fmt);

Does this have a negative effect on compatibility or performance? (In
both cases I'm asking about the case when actually using GL rendering.)


More information about the ffmpeg-devel mailing list