summaryrefslogtreecommitdiff
path: root/vp10/encoder
diff options
context:
space:
mode:
authorRonald S. Bultje <rsbultje@gmail.com>2015-09-15 21:56:51 -0400
committerRonald S. Bultje <rsbultje@gmail.com>2015-09-16 06:41:46 -0400
commiteeb5ef0a240cb7c69d5e92cdd9879032fb4bc5a7 (patch)
treed5c3713996f6630ffe9cfd0bf3c69ecb636d6a59 /vp10/encoder
parente562c71783d303bab7f9d6a9852db3debec3f865 (diff)
downloadlibvpx-eeb5ef0a240cb7c69d5e92cdd9879032fb4bc5a7.tar
libvpx-eeb5ef0a240cb7c69d5e92cdd9879032fb4bc5a7.tar.gz
libvpx-eeb5ef0a240cb7c69d5e92cdd9879032fb4bc5a7.tar.bz2
libvpx-eeb5ef0a240cb7c69d5e92cdd9879032fb4bc5a7.zip
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
Diffstat (limited to 'vp10/encoder')
-rw-r--r--vp10/encoder/bitstream.c3
-rw-r--r--vp10/encoder/encoder.c3
-rw-r--r--vp10/encoder/encoder.h1
3 files changed, 6 insertions, 1 deletions
diff --git a/vp10/encoder/bitstream.c b/vp10/encoder/bitstream.c
index eb5a86714..8d84a8590 100644
--- a/vp10/encoder/bitstream.c
+++ b/vp10/encoder/bitstream.c
@@ -1055,7 +1055,8 @@ static void write_bitdepth_colorspace_sampling(
}
vpx_wb_write_literal(wb, cm->color_space, 3);
if (cm->color_space != VPX_CS_SRGB) {
- vpx_wb_write_bit(wb, 0); // 0: [16, 235] (i.e. xvYCC), 1: [0, 255]
+ // 0: [16, 235] (i.e. xvYCC), 1: [0, 255]
+ vpx_wb_write_bit(wb, cm->color_range);
if (cm->profile == PROFILE_1 || cm->profile == PROFILE_3) {
assert(cm->subsampling_x != 1 || cm->subsampling_y != 1);
vpx_wb_write_bit(wb, cm->subsampling_x);
diff --git a/vp10/encoder/encoder.c b/vp10/encoder/encoder.c
index 58c6423cb..08ce94495 100644
--- a/vp10/encoder/encoder.c
+++ b/vp10/encoder/encoder.c
@@ -735,6 +735,7 @@ static void init_config(struct VP10_COMP *cpi, VP10EncoderConfig *oxcf) {
cm->use_highbitdepth = oxcf->use_highbitdepth;
#endif
cm->color_space = oxcf->color_space;
+ cm->color_range = oxcf->color_range;
cm->width = oxcf->width;
cm->height = oxcf->height;
@@ -1406,6 +1407,7 @@ void vp10_change_config(struct VP10_COMP *cpi, const VP10EncoderConfig *oxcf) {
cm->profile = oxcf->profile;
cm->bit_depth = oxcf->bit_depth;
cm->color_space = oxcf->color_space;
+ cm->color_range = oxcf->color_range;
if (cm->profile <= PROFILE_1)
assert(cm->bit_depth == VPX_BITS_8);
@@ -3624,6 +3626,7 @@ static void encode_frame_to_data_rate(VP10_COMP *cpi,
cm->frame_to_show = get_frame_new_buffer(cm);
cm->frame_to_show->color_space = cm->color_space;
+ cm->frame_to_show->color_range = cm->color_range;
// Pick the loop filter level for the frame.
loopfilter_frame(cpi, cm);
diff --git a/vp10/encoder/encoder.h b/vp10/encoder/encoder.h
index d0beac440..8ab1efab9 100644
--- a/vp10/encoder/encoder.h
+++ b/vp10/encoder/encoder.h
@@ -228,6 +228,7 @@ typedef struct VP10EncoderConfig {
int use_highbitdepth;
#endif
vpx_color_space_t color_space;
+ int color_range;
} VP10EncoderConfig;
static INLINE int is_lossless_requested(const VP10EncoderConfig *cfg) {