Commit d5ac877f authored by Dmitry Kovalev's avatar Dmitry Kovalev
Browse files

Adding COLOR_SPACE enum.

Change-Id: If5711eb166609cce0a88b3cb5b56b3afeebc4fb0
parent 9f528ce0
......@@ -76,4 +76,15 @@ typedef enum {
ADST_ADST = 3 // ADST in both directions
} TX_TYPE;
typedef enum {
UNKNOWN = 0,
BT_601 = 1, // YUV
BT_709 = 2, // YUV
SMPTE_170 = 3, // YUV
SMPTE_240 = 4, // YUV
RESERVED_1 = 5,
RESERVED_2 = 6,
SRGB = 7 // RGB
} COLOR_SPACE;
#endif // VP9_COMMON_VP9_ENUMS_H_
......@@ -90,6 +90,8 @@ typedef struct VP9Common {
DECLARE_ALIGNED(16, int16_t, a_dequant[QINDEX_RANGE][8]);
#endif
COLOR_SPACE color_space;
int width;
int height;
int display_width;
......
......@@ -898,12 +898,10 @@ static size_t read_uncompressed_header(VP9D_COMP *pbi,
cm->error_resilient_mode = vp9_rb_read_bit(rb);
if (cm->frame_type == KEY_FRAME) {
int csp;
check_sync_code(cm, rb);
csp = vp9_rb_read_literal(rb, 3); // colorspace
if (csp != 7) { // != sRGB
cm->color_space = vp9_rb_read_literal(rb, 3); // colorspace
if (cm->color_space != SRGB) {
vp9_rb_read_bit(rb); // [16,235] (including xvycc) vs [0,255] range
if (cm->version == 1) {
cm->subsampling_x = vp9_rb_read_bit(rb);
......
......@@ -1318,18 +1318,10 @@ static void write_uncompressed_header(VP9_COMP *cpi,
vp9_wb_write_bit(wb, cm->error_resilient_mode);
if (cm->frame_type == KEY_FRAME) {
const COLOR_SPACE cs = UNKNOWN;
write_sync_code(wb);
// colorspaces
// 000 - Unknown
// 001 - BT.601
// 010 - BT.709
// 011 - SMPTE-170
// 100 - SMPTE-240
// 101 - Reserved
// 110 - Reserved
// 111 - sRGB (RGB)
vp9_wb_write_literal(wb, 0, 3);
if (1 /* colorspace != sRGB */) {
vp9_wb_write_literal(wb, cs, 3);
if (cs != SRGB) {
vp9_wb_write_bit(wb, 0); // 0: [16, 235] (i.e. xvYCC), 1: [0, 255]
if (cm->version == 1) {
vp9_wb_write_bit(wb, cm->subsampling_x);
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment