summaryrefslogtreecommitdiff
path: root/vp9/encoder/vp9_bitstream.c
diff options
context:
space:
mode:
Diffstat (limited to 'vp9/encoder/vp9_bitstream.c')
-rw-r--r--vp9/encoder/vp9_bitstream.c23
1 files changed, 15 insertions, 8 deletions
diff --git a/vp9/encoder/vp9_bitstream.c b/vp9/encoder/vp9_bitstream.c
index 4313418d4..8d2afb991 100644
--- a/vp9/encoder/vp9_bitstream.c
+++ b/vp9/encoder/vp9_bitstream.c
@@ -1031,19 +1031,22 @@ static void write_sync_code(struct vp9_write_bit_buffer *wb) {
vp9_wb_write_literal(wb, VP9_SYNC_CODE_2, 8);
}
+static void write_profile(BITSTREAM_PROFILE profile,
+ struct vp9_write_bit_buffer *wb) {
+ assert(profile < MAX_PROFILES);
+ vp9_wb_write_bit(wb, profile & 1);
+ vp9_wb_write_bit(wb, profile >> 1);
+}
+
static void write_uncompressed_header(VP9_COMP *cpi,
struct vp9_write_bit_buffer *wb) {
VP9_COMMON *const cm = &cpi->common;
vp9_wb_write_literal(wb, VP9_FRAME_MARKER, 2);
- // bitstream version.
- // 00 - profile 0. 4:2:0 only
- // 10 - profile 1. adds 4:4:4, 4:2:2, alpha
- vp9_wb_write_bit(wb, cm->version);
- vp9_wb_write_bit(wb, 0);
+ write_profile(cm->profile, wb);
- vp9_wb_write_bit(wb, 0);
+ vp9_wb_write_bit(wb, 0); // show_existing_frame
vp9_wb_write_bit(wb, cm->frame_type);
vp9_wb_write_bit(wb, cm->show_frame);
vp9_wb_write_bit(wb, cm->error_resilient_mode);
@@ -1051,16 +1054,20 @@ static void write_uncompressed_header(VP9_COMP *cpi,
if (cm->frame_type == KEY_FRAME) {
const COLOR_SPACE cs = UNKNOWN;
write_sync_code(wb);
+ if (cm->profile > PROFILE_1) {
+ assert(cm->bit_depth > BITS_8);
+ vp9_wb_write_bit(wb, cm->bit_depth - BITS_10);
+ }
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) {
+ if (cm->profile >= PROFILE_1) {
vp9_wb_write_bit(wb, cm->subsampling_x);
vp9_wb_write_bit(wb, cm->subsampling_y);
vp9_wb_write_bit(wb, 0); // has extra plane
}
} else {
- assert(cm->version == 1);
+ assert(cm->profile == PROFILE_1);
vp9_wb_write_bit(wb, 0); // has extra plane
}