[FFmpeg-cvslog] h264: move intra_pcm_ptr into the per-slice context

Anton Khirnov git at videolan.org
Sat Mar 21 15:44:20 CET 2015


ffmpeg | branch: master | Anton Khirnov <anton at khirnov.net> | Sat Jan 17 22:28:46 2015 +0100| [b063582e0c4f775a8ba377488bd085595e0e7fae] | committer: Anton Khirnov

h264: move intra_pcm_ptr into the per-slice context

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

 libavcodec/h264.h             |    2 +-
 libavcodec/h264_cabac.c       |    2 +-
 libavcodec/h264_cavlc.c       |    2 +-
 libavcodec/h264_mb_template.c |   12 ++++++------
 4 files changed, 9 insertions(+), 9 deletions(-)

diff --git a/libavcodec/h264.h b/libavcodec/h264.h
index 882aeb5..83c9962 100644
--- a/libavcodec/h264.h
+++ b/libavcodec/h264.h
@@ -374,6 +374,7 @@ typedef struct H264SliceContext {
                                          *   according to picture reordering in slice header */
     int ref2frm[MAX_SLICES][2][64];     ///< reference to frame number lists, used in the loop filter, the first 2 are for -2,-1
 
+    const uint8_t *intra_pcm_ptr;
 
     /**
      * non zero coeff count cache.
@@ -468,7 +469,6 @@ typedef struct H264Context {
     GetBitContext *intra_gb_ptr;
     GetBitContext *inter_gb_ptr;
 
-    const uint8_t *intra_pcm_ptr;
     DECLARE_ALIGNED(16, int16_t, mb)[16 * 48 * 2]; ///< as a dct coeffecient is int32_t in high depth, we need to reserve twice the space.
     DECLARE_ALIGNED(16, int16_t, mb_luma_dc)[3][16 * 2];
     int16_t mb_padding[256 * 2];        ///< as mb is addressed by scantable[i] and scantable is uint8_t we can either check that i is not too large or ensure that there is some unused stuff after mb
diff --git a/libavcodec/h264_cabac.c b/libavcodec/h264_cabac.c
index 1c23609..dd3898d 100644
--- a/libavcodec/h264_cabac.c
+++ b/libavcodec/h264_cabac.c
@@ -2031,7 +2031,7 @@ decode_intra_mb:
         // The pixels are stored in the same order as levels in h->mb array.
         if ((int) (h->cabac.bytestream_end - ptr) < mb_size)
             return -1;
-        h->intra_pcm_ptr = ptr;
+        sl->intra_pcm_ptr = ptr;
         ptr += mb_size;
 
         ff_init_cabac_decoder(&h->cabac, ptr, h->cabac.bytestream_end - ptr);
diff --git a/libavcodec/h264_cavlc.c b/libavcodec/h264_cavlc.c
index 63faabf..50094b3 100644
--- a/libavcodec/h264_cavlc.c
+++ b/libavcodec/h264_cavlc.c
@@ -770,7 +770,7 @@ decode_intra_mb:
                             h->sps.bit_depth_luma;
 
         // We assume these blocks are very rare so we do not optimize it.
-        h->intra_pcm_ptr = align_get_bits(&h->gb);
+        sl->intra_pcm_ptr = align_get_bits(&h->gb);
         if (get_bits_left(&h->gb) < mb_size) {
             av_log(h->avctx, AV_LOG_ERROR, "Not enough data for an intra PCM block.\n");
             return AVERROR_INVALIDDATA;
diff --git a/libavcodec/h264_mb_template.c b/libavcodec/h264_mb_template.c
index 7ce72ba..c4e5493 100644
--- a/libavcodec/h264_mb_template.c
+++ b/libavcodec/h264_mb_template.c
@@ -104,7 +104,7 @@ static av_noinline void FUNC(hl_decode_mb)(H264Context *h, H264SliceContext *sl)
             const int bit_depth = h->sps.bit_depth_luma;
             int j;
             GetBitContext gb;
-            init_get_bits(&gb, h->intra_pcm_ptr,
+            init_get_bits(&gb, sl->intra_pcm_ptr,
                           ff_h264_mb_sizes[h->sps.chroma_format_idc] * bit_depth);
 
             for (i = 0; i < 16; i++) {
@@ -139,7 +139,7 @@ static av_noinline void FUNC(hl_decode_mb)(H264Context *h, H264SliceContext *sl)
             }
         } else {
             for (i = 0; i < 16; i++)
-                memcpy(dest_y + i * linesize, h->intra_pcm_ptr + i * 16, 16);
+                memcpy(dest_y + i * linesize, sl->intra_pcm_ptr + i * 16, 16);
             if (SIMPLE || !CONFIG_GRAY || !(h->flags & CODEC_FLAG_GRAY)) {
                 if (!h->sps.chroma_format_idc) {
                     for (i = 0; i < block_h; i++) {
@@ -147,8 +147,8 @@ static av_noinline void FUNC(hl_decode_mb)(H264Context *h, H264SliceContext *sl)
                         memset(dest_cr + i * uvlinesize, 128, 8);
                     }
                 } else {
-                    const uint8_t *src_cb = h->intra_pcm_ptr + 256;
-                    const uint8_t *src_cr = h->intra_pcm_ptr + 256 + block_h * 8;
+                    const uint8_t *src_cb = sl->intra_pcm_ptr + 256;
+                    const uint8_t *src_cr = sl->intra_pcm_ptr + 256 + block_h * 8;
                     for (i = 0; i < block_h; i++) {
                         memcpy(dest_cb + i * uvlinesize, src_cb + i * 8, 8);
                         memcpy(dest_cr + i * uvlinesize, src_cr + i * 8, 8);
@@ -326,7 +326,7 @@ static av_noinline void FUNC(hl_decode_mb_444)(H264Context *h, H264SliceContext
         if (PIXEL_SHIFT) {
             const int bit_depth = h->sps.bit_depth_luma;
             GetBitContext gb;
-            init_get_bits(&gb, h->intra_pcm_ptr, 768 * bit_depth);
+            init_get_bits(&gb, sl->intra_pcm_ptr, 768 * bit_depth);
 
             for (p = 0; p < plane_count; p++)
                 for (i = 0; i < 16; i++) {
@@ -338,7 +338,7 @@ static av_noinline void FUNC(hl_decode_mb_444)(H264Context *h, H264SliceContext
             for (p = 0; p < plane_count; p++)
                 for (i = 0; i < 16; i++)
                     memcpy(dest[p] + i * linesize,
-                           h->intra_pcm_ptr + p * 256 + i * 16, 16);
+                           sl->intra_pcm_ptr + p * 256 + i * 16, 16);
         }
     } else {
         if (IS_INTRA(mb_type)) {



More information about the ffmpeg-cvslog mailing list