[FFmpeg-devel] [PATCH] libvpx: Support setting color range for vp9.

James Almer jamrial at gmail.com
Wed Dec 30 19:56:29 CET 2015


On 12/30/2015 3:47 PM, James Almer wrote:
> On 12/30/2015 3:23 PM, Sasi Inguva wrote:
>> Pass through color range to vp9 encoder, and parse it in libvpxdec
>>
>> Signed-off-by: Sasi Inguva <isasi at google.com>
>> ---
>>  libavcodec/libvpxdec.c |  4 ++++
>>  libavcodec/libvpxenc.c | 20 ++++++++++++++++++++
>>  2 files changed, 24 insertions(+)
>>
>> diff --git a/libavcodec/libvpxdec.c b/libavcodec/libvpxdec.c
>> index 7267590..169a137 100644
>> --- a/libavcodec/libvpxdec.c
>> +++ b/libavcodec/libvpxdec.c
>> @@ -68,6 +68,10 @@ static int set_pix_fmt(AVCodecContext *avctx, struct vpx_image *img)
>>          AVCOL_SPC_SMPTE240M, AVCOL_SPC_BT2020_NCL, AVCOL_SPC_RESERVED, AVCOL_SPC_RGB,
>>      };
>>      avctx->colorspace = colorspaces[img->cs];
>> +    static const enum AVColorRange color_ranges[8] = {
> 
> Mixed declarations and code. Also, shouldn't it be [2]?
> 

This also fails with libvpx 1.4.0. The VPX_ENCODER_ABI_VERSION check is not enough.


CC libavcodec/libvpxdec.o
CC libavcodec/libvpxenc.o
/ffmpeg/src/libavcodec/libvpxdec.c: In function 'set_pix_fmt':
/ffmpeg/src/libavcodec/libvpxdec.c:71:5: warning: ISO C90 forbids mixed declarations and code [-Wdeclaration-after-statement]
static const enum AVColorRange color_ranges[8] = {
^
/ffmpeg/src/libavcodec/libvpxdec.c:74:42: error: 'struct vpx_image' has no member named 'range'
avctx->color_range = color_ranges[img->range];
^
/ffmpeg/src/libavcodec/libvpxdec.c:71:36: warning: variable 'color_ranges' set but not used [-Wunused-but-set-variable]
static const enum AVColorRange color_ranges[8] = {
^
/ffmpeg/src/libavcodec/libvpxenc.c:126:6: error: 'VP9E_SET_COLOR_RANGE' undeclared here (not in a function)
[VP9E_SET_COLOR_RANGE] = "VP9E_SET_COLOR_RANGE",
^
/ffmpeg/src/libavcodec/libvpxenc.c:126:6: error: array index in initializer not of integer type
/ffmpeg/src/libavcodec/libvpxenc.c:126:6: note: (near initialization for 'ctlidstr')
/ffmpeg/src/libavcodec/libvpxenc.c: In function 'set_color_range':
/ffmpeg/src/libavcodec/libvpxenc.c:373:26: error: storage size of 'vpx_cr' isn't known
enum vpx_color_range vpx_cr;
^
/ffmpeg/src/libavcodec/libvpxenc.c:377:18: error: 'VPX_CR_STUDIO_RANGE' undeclared (first use in this function)
vpx_cr = VPX_CR_STUDIO_RANGE; break;
^
/ffmpeg/src/libavcodec/libvpxenc.c:377:18: note: each undeclared identifier is reported only once for each function it appears in
/ffmpeg/src/libavcodec/libvpxenc.c:379:18: error: 'VPX_CR_FULL_RANGE' undeclared (first use in this function)
vpx_cr = VPX_CR_FULL_RANGE; break;
^
/ffmpeg/src/libavcodec/libvpxenc.c:373:26: warning: unused variable 'vpx_cr' [-Wunused-variable]
enum vpx_color_range vpx_cr;
^
/ffmpeg/src/common.mak:60: recipe for target 'libavcodec/libvpxdec.o' failed
make: *** [libavcodec/libvpxdec.o] Error 1
make: *** Waiting for unfinished jobs....
/ffmpeg/src/common.mak:60: recipe for target 'libavcodec/libvpxenc.o' failed
make: *** [libavcodec/libvpxenc.o] Error 1


More information about the ffmpeg-devel mailing list