Commit 3e22da3d authored by Thomas Daede's avatar Thomas Daede Committed by Sebastien Alaiwan

Remove unused bytes from uncompressed header.

Although they are called "sync codes", nothing is synchronized
using them.

Change-Id: I2dbd67daf9f4822438323212bb96cac489c38c5d
parent f12cc4a4
...@@ -290,8 +290,6 @@ static aom_codec_err_t decoder_peek_si_internal( ...@@ -290,8 +290,6 @@ static aom_codec_err_t decoder_peek_si_internal(
} }
#endif #endif
if (si->is_kf) { if (si->is_kf) {
if (!av1_read_sync_code(&rb)) return AOM_CODEC_UNSUP_BITSTREAM;
if (!parse_bitdepth_colorspace_sampling(profile, &rb)) if (!parse_bitdepth_colorspace_sampling(profile, &rb))
return AOM_CODEC_UNSUP_BITSTREAM; return AOM_CODEC_UNSUP_BITSTREAM;
av1_read_frame_size(&rb, (int *)&si->w, (int *)&si->h); av1_read_frame_size(&rb, (int *)&si->w, (int *)&si->h);
...@@ -301,7 +299,6 @@ static aom_codec_err_t decoder_peek_si_internal( ...@@ -301,7 +299,6 @@ static aom_codec_err_t decoder_peek_si_internal(
rb.bit_offset += error_resilient ? 0 : 2; // reset_frame_context rb.bit_offset += error_resilient ? 0 : 2; // reset_frame_context
if (intra_only_flag) { if (intra_only_flag) {
if (!av1_read_sync_code(&rb)) return AOM_CODEC_UNSUP_BITSTREAM;
if (profile > PROFILE_0) { if (profile > PROFILE_0) {
if (!parse_bitdepth_colorspace_sampling(profile, &rb)) if (!parse_bitdepth_colorspace_sampling(profile, &rb))
return AOM_CODEC_UNSUP_BITSTREAM; return AOM_CODEC_UNSUP_BITSTREAM;
......
...@@ -50,10 +50,6 @@ static INLINE int get_unsigned_bits(unsigned int num_values) { ...@@ -50,10 +50,6 @@ static INLINE int get_unsigned_bits(unsigned int num_values) {
#define CHECK_MEM_ERROR(cm, lval, expr) \ #define CHECK_MEM_ERROR(cm, lval, expr) \
AOM_CHECK_MEM_ERROR(&cm->error, lval, expr) AOM_CHECK_MEM_ERROR(&cm->error, lval, expr)
// TODO(yaowu: validate the usage of these codes or develop new ones.)
#define AV1_SYNC_CODE_0 0x49
#define AV1_SYNC_CODE_1 0x83
#define AV1_SYNC_CODE_2 0x43
#define AOM_FRAME_MARKER 0x2 #define AOM_FRAME_MARKER 0x2
......
...@@ -4722,9 +4722,6 @@ static size_t read_uncompressed_header(AV1Decoder *pbi, ...@@ -4722,9 +4722,6 @@ static size_t read_uncompressed_header(AV1Decoder *pbi,
} }
#endif #endif
if (cm->frame_type == KEY_FRAME) { if (cm->frame_type == KEY_FRAME) {
if (!av1_read_sync_code(rb))
aom_internal_error(&cm->error, AOM_CODEC_UNSUP_BITSTREAM,
"Invalid frame sync code");
#if !CONFIG_OBU #if !CONFIG_OBU
read_bitdepth_colorspace_sampling(cm, rb, pbi->allow_lowbitdepth); read_bitdepth_colorspace_sampling(cm, rb, pbi->allow_lowbitdepth);
#endif #endif
...@@ -4795,9 +4792,6 @@ static size_t read_uncompressed_header(AV1Decoder *pbi, ...@@ -4795,9 +4792,6 @@ static size_t read_uncompressed_header(AV1Decoder *pbi,
#endif #endif
if (cm->intra_only) { if (cm->intra_only) {
if (!av1_read_sync_code(rb))
aom_internal_error(&cm->error, AOM_CODEC_UNSUP_BITSTREAM,
"Invalid frame sync code");
#if !CONFIG_OBU #if !CONFIG_OBU
read_bitdepth_colorspace_sampling(cm, rb, pbi->allow_lowbitdepth); read_bitdepth_colorspace_sampling(cm, rb, pbi->allow_lowbitdepth);
#endif #endif
...@@ -5352,12 +5346,6 @@ static struct aom_read_bit_buffer *init_read_bit_buffer( ...@@ -5352,12 +5346,6 @@ static struct aom_read_bit_buffer *init_read_bit_buffer(
//------------------------------------------------------------------------------ //------------------------------------------------------------------------------
int av1_read_sync_code(struct aom_read_bit_buffer *const rb) {
return aom_rb_read_literal(rb, 8) == AV1_SYNC_CODE_0 &&
aom_rb_read_literal(rb, 8) == AV1_SYNC_CODE_1 &&
aom_rb_read_literal(rb, 8) == AV1_SYNC_CODE_2;
}
void av1_read_frame_size(struct aom_read_bit_buffer *rb, int *width, void av1_read_frame_size(struct aom_read_bit_buffer *rb, int *width,
int *height) { int *height) {
*width = aom_rb_read_literal(rb, 16) + 1; *width = aom_rb_read_literal(rb, 16) + 1;
......
...@@ -24,7 +24,6 @@ struct aom_read_bit_buffer; ...@@ -24,7 +24,6 @@ struct aom_read_bit_buffer;
void read_sequence_header(SequenceHeader *seq_params); void read_sequence_header(SequenceHeader *seq_params);
#endif #endif
int av1_read_sync_code(struct aom_read_bit_buffer *const rb);
void av1_read_frame_size(struct aom_read_bit_buffer *rb, int *width, void av1_read_frame_size(struct aom_read_bit_buffer *rb, int *width,
int *height); int *height);
BITSTREAM_PROFILE av1_read_profile(struct aom_read_bit_buffer *rb); BITSTREAM_PROFILE av1_read_profile(struct aom_read_bit_buffer *rb);
......
...@@ -4268,12 +4268,6 @@ static void write_frame_size_with_refs(AV1_COMP *cpi, ...@@ -4268,12 +4268,6 @@ static void write_frame_size_with_refs(AV1_COMP *cpi,
if (!found) write_frame_size(cm, wb); if (!found) write_frame_size(cm, wb);
} }
static void write_sync_code(struct aom_write_bit_buffer *wb) {
aom_wb_write_literal(wb, AV1_SYNC_CODE_0, 8);
aom_wb_write_literal(wb, AV1_SYNC_CODE_1, 8);
aom_wb_write_literal(wb, AV1_SYNC_CODE_2, 8);
}
static void write_profile(BITSTREAM_PROFILE profile, static void write_profile(BITSTREAM_PROFILE profile,
struct aom_write_bit_buffer *wb) { struct aom_write_bit_buffer *wb) {
switch (profile) { switch (profile) {
...@@ -4566,7 +4560,6 @@ static void write_uncompressed_header_frame(AV1_COMP *cpi, ...@@ -4566,7 +4560,6 @@ static void write_uncompressed_header_frame(AV1_COMP *cpi,
#endif #endif
if (cm->frame_type == KEY_FRAME) { if (cm->frame_type == KEY_FRAME) {
write_sync_code(wb);
write_bitdepth_colorspace_sampling(cm, wb); write_bitdepth_colorspace_sampling(cm, wb);
write_frame_size(cm, wb); write_frame_size(cm, wb);
write_sb_size(cm, wb); write_sb_size(cm, wb);
...@@ -4609,7 +4602,6 @@ static void write_uncompressed_header_frame(AV1_COMP *cpi, ...@@ -4609,7 +4602,6 @@ static void write_uncompressed_header_frame(AV1_COMP *cpi,
#endif // CONFIG_EXT_REFS #endif // CONFIG_EXT_REFS
if (cm->intra_only) { if (cm->intra_only) {
write_sync_code(wb);
write_bitdepth_colorspace_sampling(cm, wb); write_bitdepth_colorspace_sampling(cm, wb);
#if CONFIG_EXT_REFS #if CONFIG_EXT_REFS
...@@ -4852,7 +4844,6 @@ static void write_uncompressed_header_obu(AV1_COMP *cpi, ...@@ -4852,7 +4844,6 @@ static void write_uncompressed_header_obu(AV1_COMP *cpi,
#endif #endif
if (cm->frame_type == KEY_FRAME) { if (cm->frame_type == KEY_FRAME) {
write_sync_code(wb);
write_frame_size(cm, wb); write_frame_size(cm, wb);
write_sb_size(cm, wb); write_sb_size(cm, wb);
...@@ -4887,8 +4878,6 @@ static void write_uncompressed_header_obu(AV1_COMP *cpi, ...@@ -4887,8 +4878,6 @@ static void write_uncompressed_header_obu(AV1_COMP *cpi,
#endif // CONFIG_EXT_REFS #endif // CONFIG_EXT_REFS
if (cm->intra_only) { if (cm->intra_only) {
write_sync_code(wb);
#if CONFIG_EXT_REFS #if CONFIG_EXT_REFS
aom_wb_write_literal(wb, cpi->refresh_frame_mask, REF_FRAMES); aom_wb_write_literal(wb, cpi->refresh_frame_mask, REF_FRAMES);
#else #else
......
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