[FFmpeg-cvslog] h264: Factorize declaration of mb_sizes array.

Diego Biurrun git at videolan.org
Thu Apr 5 22:44:34 CEST 2012


ffmpeg | branch: master | Diego Biurrun <diego at biurrun.de> | Wed Apr  4 14:53:25 2012 +0200| [0becb07842b57ea225ddf0726de33b5f8e669297] | committer: Diego Biurrun

h264: Factorize declaration of mb_sizes array.

> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=0becb07842b57ea225ddf0726de33b5f8e669297
---

 libavcodec/h264.c       |    5 +++--
 libavcodec/h264.h       |    1 +
 libavcodec/h264_cabac.c |    4 ++--
 libavcodec/h264_cavlc.c |    4 ++--
 4 files changed, 8 insertions(+), 6 deletions(-)

diff --git a/libavcodec/h264.c b/libavcodec/h264.c
index 6a1a8b6..890dd22 100644
--- a/libavcodec/h264.c
+++ b/libavcodec/h264.c
@@ -45,6 +45,8 @@
 // #undef NDEBUG
 #include <assert.h>
 
+const uint16_t ff_h264_mb_sizes[4] = { 256, 384, 512, 768 };
+
 static const uint8_t rem6[QP_MAX_NUM + 1] = {
     0, 1, 2, 3, 4, 5, 0, 1, 2, 3, 4, 5, 0, 1, 2, 3, 4, 5, 0, 1, 2,
     3, 4, 5, 0, 1, 2, 3, 4, 5, 0, 1, 2, 3, 4, 5, 0, 1, 2, 3, 4, 5,
@@ -2138,12 +2140,11 @@ static av_always_inline void hl_decode_mb_internal(H264Context *h, int simple,
 
     if (!simple && IS_INTRA_PCM(mb_type)) {
         if (pixel_shift) {
-            static const uint16_t mb_sizes[4] = { 256, 384, 512, 768 };
             const int bit_depth = h->sps.bit_depth_luma;
             int j;
             GetBitContext gb;
             init_get_bits(&gb, (uint8_t *)h->mb,
-                          mb_sizes[h->sps.chroma_format_idc] * bit_depth);
+                          ff_h264_mb_sizes[h->sps.chroma_format_idc] * bit_depth);
 
             for (i = 0; i < 16; i++) {
                 uint16_t *tmp_y = (uint16_t *)(dest_y + i * linesize);
diff --git a/libavcodec/h264.h b/libavcodec/h264.h
index 99c46cc..ce06f61 100644
--- a/libavcodec/h264.h
+++ b/libavcodec/h264.h
@@ -584,6 +584,7 @@ typedef struct H264Context{
 
 
 extern const uint8_t ff_h264_chroma_qp[3][QP_MAX_NUM+1]; ///< One chroma qp table for each supported bit depth (8, 9, 10).
+extern const uint16_t ff_h264_mb_sizes[4];
 
 /**
  * Decode SEI
diff --git a/libavcodec/h264_cabac.c b/libavcodec/h264_cabac.c
index 8b42f04..9e1cf1b 100644
--- a/libavcodec/h264_cabac.c
+++ b/libavcodec/h264_cabac.c
@@ -1983,8 +1983,8 @@ decode_intra_mb:
     h->slice_table[ mb_xy ]= h->slice_num;
 
     if(IS_INTRA_PCM(mb_type)) {
-        static const uint16_t mb_sizes[4] = {256,384,512,768};
-        const int mb_size = mb_sizes[h->sps.chroma_format_idc]*h->sps.bit_depth_luma >> 3;
+        const int mb_size = ff_h264_mb_sizes[h->sps.chroma_format_idc] *
+                            h->sps.bit_depth_luma >> 3;
         const uint8_t *ptr;
 
         // We assume these blocks are very rare so we do not optimize it.
diff --git a/libavcodec/h264_cavlc.c b/libavcodec/h264_cavlc.c
index a5b6403..c4159e2 100644
--- a/libavcodec/h264_cavlc.c
+++ b/libavcodec/h264_cavlc.c
@@ -764,8 +764,8 @@ decode_intra_mb:
 
     if(IS_INTRA_PCM(mb_type)){
         unsigned int x;
-        static const uint16_t mb_sizes[4] = {256,384,512,768};
-        const int mb_size = mb_sizes[h->sps.chroma_format_idc]*h->sps.bit_depth_luma >> 3;
+        const int mb_size = ff_h264_mb_sizes[h->sps.chroma_format_idc] *
+                            h->sps.bit_depth_luma >> 3;
 
         // We assume these blocks are very rare so we do not optimize it.
         align_get_bits(&s->gb);



More information about the ffmpeg-cvslog mailing list