From eeb5ef0a240cb7c69d5e92cdd9879032fb4bc5a7 Mon Sep 17 00:00:00 2001 From: "Ronald S. Bultje" Date: Tue, 15 Sep 2015 21:56:51 -0400 Subject: Add support for color-range. In decoder, export (eventually) into vpx_image_t.range field. In encoder, use oxcf->color_range to set it (same way as for color_space). See issue 1059. Change-Id: Ieabbb2a785fa58cc4044bd54eee66f328f3906ce --- vp10/decoder/decodeframe.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) (limited to 'vp10/decoder') diff --git a/vp10/decoder/decodeframe.c b/vp10/decoder/decodeframe.c index e31cf7283..b4c884192 100644 --- a/vp10/decoder/decodeframe.c +++ b/vp10/decoder/decodeframe.c @@ -1228,6 +1228,7 @@ static void setup_frame_size(VP10_COMMON *cm, struct vpx_read_bit_buffer *rb) { pool->frame_bufs[cm->new_fb_idx].buf.subsampling_y = cm->subsampling_y; pool->frame_bufs[cm->new_fb_idx].buf.bit_depth = (unsigned int)cm->bit_depth; pool->frame_bufs[cm->new_fb_idx].buf.color_space = cm->color_space; + pool->frame_bufs[cm->new_fb_idx].buf.color_range = cm->color_range; } static INLINE int valid_ref_frame_img_fmt(vpx_bit_depth_t ref_bit_depth, @@ -1309,6 +1310,7 @@ static void setup_frame_size_with_refs(VP10_COMMON *cm, pool->frame_bufs[cm->new_fb_idx].buf.subsampling_y = cm->subsampling_y; pool->frame_bufs[cm->new_fb_idx].buf.bit_depth = (unsigned int)cm->bit_depth; pool->frame_bufs[cm->new_fb_idx].buf.color_space = cm->color_space; + pool->frame_bufs[cm->new_fb_idx].buf.color_range = cm->color_range; } static void setup_tile_info(VP10_COMMON *cm, struct vpx_read_bit_buffer *rb) { @@ -1749,7 +1751,8 @@ static void read_bitdepth_colorspace_sampling( } cm->color_space = vpx_rb_read_literal(rb, 3); if (cm->color_space != VPX_CS_SRGB) { - vpx_rb_read_bit(rb); // [16,235] (including xvycc) vs [0,255] range + // [16,235] (including xvycc) vs [0,255] range + cm->color_range = vpx_rb_read_bit(rb); if (cm->profile == PROFILE_1 || cm->profile == PROFILE_3) { cm->subsampling_x = vpx_rb_read_bit(rb); cm->subsampling_y = vpx_rb_read_bit(rb); @@ -1893,6 +1896,7 @@ static size_t read_uncompressed_header(VP10Decoder *pbi, // specifies that the default color format should be YUV 4:2:0 in this // case (normative). cm->color_space = VPX_CS_BT_601; + cm->color_range = 0; cm->subsampling_y = cm->subsampling_x = 1; cm->bit_depth = VPX_BITS_8; #if CONFIG_VP9_HIGHBITDEPTH @@ -1943,6 +1947,7 @@ static size_t read_uncompressed_header(VP10Decoder *pbi, get_frame_new_buffer(cm)->bit_depth = cm->bit_depth; #endif get_frame_new_buffer(cm)->color_space = cm->color_space; + get_frame_new_buffer(cm)->color_range = cm->color_range; if (pbi->need_resync) { vpx_internal_error(&cm->error, VPX_CODEC_CORRUPT_FRAME, -- cgit v1.2.3