From a53075f7c5c5828f171008f9cd66d9dd97d4387c Mon Sep 17 00:00:00 2001 From: Dmitry Kovalev Date: Wed, 23 Oct 2013 17:24:17 -0700 Subject: [PATCH] Adding VP9_FRAME_MARKER constant. Also renaming SYNC_CODE_* to VP9_SYNC_CODE_*. Change-Id: I9ff504c6ebce6cd6673d7df2085d597b818f5960 --- vp9/common/vp9_common.h | 8 +++++--- vp9/decoder/vp9_decodframe.c | 8 ++++---- vp9/encoder/vp9_bitstream.c | 9 ++++----- vp9/vp9_dx_iface.c | 6 +++--- 4 files changed, 16 insertions(+), 15 deletions(-) diff --git a/vp9/common/vp9_common.h b/vp9/common/vp9_common.h index 3ac192b4a..36d1cdf14 100644 --- a/vp9/common/vp9_common.h +++ b/vp9/common/vp9_common.h @@ -84,9 +84,11 @@ static int get_unsigned_bits(unsigned int num_values) { } while (0) #endif -#define SYNC_CODE_0 0x49 -#define SYNC_CODE_1 0x83 -#define SYNC_CODE_2 0x42 +#define VP9_SYNC_CODE_0 0x49 +#define VP9_SYNC_CODE_1 0x83 +#define VP9_SYNC_CODE_2 0x42 + +#define VP9_FRAME_MARKER 0x2 #endif // VP9_COMMON_VP9_COMMON_H_ diff --git a/vp9/decoder/vp9_decodframe.c b/vp9/decoder/vp9_decodframe.c index 3ee8ba41d..0cb0709c5 100644 --- a/vp9/decoder/vp9_decodframe.c +++ b/vp9/decoder/vp9_decodframe.c @@ -821,9 +821,9 @@ static const uint8_t *decode_tiles(VP9D_COMP *pbi, const uint8_t *data) { } static void check_sync_code(VP9_COMMON *cm, struct vp9_read_bit_buffer *rb) { - if (vp9_rb_read_literal(rb, 8) != SYNC_CODE_0 || - vp9_rb_read_literal(rb, 8) != SYNC_CODE_1 || - vp9_rb_read_literal(rb, 8) != SYNC_CODE_2) { + if (vp9_rb_read_literal(rb, 8) != VP9_SYNC_CODE_0 || + vp9_rb_read_literal(rb, 8) != VP9_SYNC_CODE_1 || + vp9_rb_read_literal(rb, 8) != VP9_SYNC_CODE_2) { vpx_internal_error(&cm->error, VPX_CODEC_UNSUP_BITSTREAM, "Invalid frame sync code"); } @@ -875,7 +875,7 @@ static size_t read_uncompressed_header(VP9D_COMP *pbi, cm->last_frame_type = cm->frame_type; - if (vp9_rb_read_literal(rb, 2) != 0x2) + if (vp9_rb_read_literal(rb, 2) != VP9_FRAME_MARKER) vpx_internal_error(&cm->error, VPX_CODEC_UNSUP_BITSTREAM, "Invalid frame marker"); diff --git a/vp9/encoder/vp9_bitstream.c b/vp9/encoder/vp9_bitstream.c index 8378a78e1..f82802df6 100644 --- a/vp9/encoder/vp9_bitstream.c +++ b/vp9/encoder/vp9_bitstream.c @@ -1295,17 +1295,16 @@ static void write_frame_size_with_refs(VP9_COMP *cpi, } static void write_sync_code(struct vp9_write_bit_buffer *wb) { - vp9_wb_write_literal(wb, SYNC_CODE_0, 8); - vp9_wb_write_literal(wb, SYNC_CODE_1, 8); - vp9_wb_write_literal(wb, SYNC_CODE_2, 8); + vp9_wb_write_literal(wb, VP9_SYNC_CODE_0, 8); + vp9_wb_write_literal(wb, VP9_SYNC_CODE_1, 8); + vp9_wb_write_literal(wb, VP9_SYNC_CODE_2, 8); } static void write_uncompressed_header(VP9_COMP *cpi, struct vp9_write_bit_buffer *wb) { VP9_COMMON *const cm = &cpi->common; - // frame marker bits - vp9_wb_write_literal(wb, 0x2, 2); + vp9_wb_write_literal(wb, VP9_FRAME_MARKER, 2); // bitstream version. // 00 - profile 0. 4:2:0 only diff --git a/vp9/vp9_dx_iface.c b/vp9/vp9_dx_iface.c index 6b923162f..5dacab454 100644 --- a/vp9/vp9_dx_iface.c +++ b/vp9/vp9_dx_iface.c @@ -172,9 +172,9 @@ static vpx_codec_err_t vp9_peek_si(const uint8_t *data, rb.bit_offset += 1; // show frame rb.bit_offset += 1; // error resilient - if (vp9_rb_read_literal(&rb, 8) != SYNC_CODE_0 || - vp9_rb_read_literal(&rb, 8) != SYNC_CODE_1 || - vp9_rb_read_literal(&rb, 8) != SYNC_CODE_2) { + if (vp9_rb_read_literal(&rb, 8) != VP9_SYNC_CODE_0 || + vp9_rb_read_literal(&rb, 8) != VP9_SYNC_CODE_1 || + vp9_rb_read_literal(&rb, 8) != VP9_SYNC_CODE_2) { return VPX_CODEC_UNSUP_BITSTREAM; }