shithub: libvpx

Download patch

ref: a53075f7c5c5828f171008f9cd66d9dd97d4387c
parent: dea22b4bdade9a854cb3d395bc25551093aa42ef
author: Dmitry Kovalev <dkovalev@google.com>
date: Wed Oct 23 13:24:17 EDT 2013

Adding VP9_FRAME_MARKER constant.

Also renaming SYNC_CODE_* to VP9_SYNC_CODE_*.

Change-Id: I9ff504c6ebce6cd6673d7df2085d597b818f5960

--- a/vp9/common/vp9_common.h
+++ b/vp9/common/vp9_common.h
@@ -84,9 +84,11 @@
   } 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_
--- a/vp9/decoder/vp9_decodframe.c
+++ b/vp9/decoder/vp9_decodframe.c
@@ -821,9 +821,9 @@
 }
 
 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 @@
 
   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");
 
--- a/vp9/encoder/vp9_bitstream.c
+++ b/vp9/encoder/vp9_bitstream.c
@@ -1295,9 +1295,9 @@
 }
 
 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,
@@ -1304,8 +1304,7 @@
                                       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
--- a/vp9/vp9_dx_iface.c
+++ b/vp9/vp9_dx_iface.c
@@ -172,9 +172,9 @@
       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;
       }