[FFmpeg-cvslog] h264_slice: constify all the uses of H264Context during slice decoding

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


ffmpeg | branch: master | Anton Khirnov <anton at khirnov.net> | Wed Jan 28 13:24:32 2015 +0100| [92e0b7342c0490894cbcea4461380321e0569de2] | committer: Anton Khirnov

h264_slice: constify all the uses of H264Context during slice decoding

All the variables modified by this code are either per-MB arrays or have
been moved to the per-slice context

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

 libavcodec/h264_slice.c |   16 ++++++++--------
 1 file changed, 8 insertions(+), 8 deletions(-)

diff --git a/libavcodec/h264_slice.c b/libavcodec/h264_slice.c
index c482877..ba5456e 100644
--- a/libavcodec/h264_slice.c
+++ b/libavcodec/h264_slice.c
@@ -704,7 +704,7 @@ static int h264_frame_start(H264Context *h)
     return 0;
 }
 
-static av_always_inline void backup_mb_border(H264Context *h, H264SliceContext *sl,
+static av_always_inline void backup_mb_border(const H264Context *h, H264SliceContext *sl,
                                               uint8_t *src_y,
                                               uint8_t *src_cb, uint8_t *src_cr,
                                               int linesize, int uvlinesize,
@@ -806,7 +806,7 @@ static av_always_inline void backup_mb_border(H264Context *h, H264SliceContext *
  * @param field  0/1 initialize the weight for interlaced MBAFF
  *                -1 initializes the rest
  */
-static void implicit_weight_table(H264Context *h, H264SliceContext *sl, int field)
+static void implicit_weight_table(const H264Context *h, H264SliceContext *sl, int field)
 {
     int ref0, ref1, i, cur_poc, ref_start, ref_count0, ref_count1;
 
@@ -1808,7 +1808,7 @@ int ff_h264_get_slice_type(const H264SliceContext *sl)
     }
 }
 
-static av_always_inline void fill_filter_caches_inter(H264Context *h,
+static av_always_inline void fill_filter_caches_inter(const H264Context *h,
                                                       H264SliceContext *sl,
                                                       int mb_type, int top_xy,
                                                       int left_xy[LEFT_MBS],
@@ -1893,7 +1893,7 @@ static av_always_inline void fill_filter_caches_inter(H264Context *h,
  *
  * @return non zero if the loop filter can be skipped
  */
-static int fill_filter_caches(H264Context *h, H264SliceContext *sl, int mb_type)
+static int fill_filter_caches(const H264Context *h, H264SliceContext *sl, int mb_type)
 {
     const int mb_xy = sl->mb_xy;
     int top_xy, left_xy[LEFT_MBS];
@@ -2038,7 +2038,7 @@ static int fill_filter_caches(H264Context *h, H264SliceContext *sl, int mb_type)
     return 0;
 }
 
-static void loop_filter(H264Context *h, H264SliceContext *sl, int start_x, int end_x)
+static void loop_filter(const H264Context *h, H264SliceContext *sl, int start_x, int end_x)
 {
     uint8_t *dest_y, *dest_cb, *dest_cr;
     int linesize, uvlinesize, mb_x, mb_y;
@@ -2107,7 +2107,7 @@ static void loop_filter(H264Context *h, H264SliceContext *sl, int start_x, int e
     sl->chroma_qp[1] = get_chroma_qp(h, 1, sl->qscale);
 }
 
-static void predict_field_decoding_flag(H264Context *h, H264SliceContext *sl)
+static void predict_field_decoding_flag(const H264Context *h, H264SliceContext *sl)
 {
     const int mb_xy = sl->mb_x + sl->mb_y * h->mb_stride;
     int mb_type     = (h->slice_table[mb_xy - 1] == sl->slice_num) ?
@@ -2120,7 +2120,7 @@ static void predict_field_decoding_flag(H264Context *h, H264SliceContext *sl)
 /**
  * Draw edges and report progress for the last MB row.
  */
-static void decode_finish_row(H264Context *h, H264SliceContext *sl)
+static void decode_finish_row(const H264Context *h, H264SliceContext *sl)
 {
     int top            = 16 * (sl->mb_y      >> FIELD_PICTURE(h));
     int pic_height     = 16 *  h->mb_height >> FIELD_PICTURE(h);
@@ -2166,7 +2166,7 @@ static void er_add_slice(H264SliceContext *sl,
 static int decode_slice(struct AVCodecContext *avctx, void *arg)
 {
     H264SliceContext *sl = arg;
-    H264Context       *h = sl->h264;
+    const H264Context *h = sl->h264;
     int lf_x_start = sl->mb_x;
     int ret;
 



More information about the ffmpeg-cvslog mailing list