[FFmpeg-cvslog] h264.c: constify all uses of H264Context in slice and lower-level functions

Anton Khirnov git at videolan.org
Sat Mar 21 18:26:49 CET 2015


ffmpeg | branch: master | Anton Khirnov <anton at khirnov.net> | Tue Jan 27 15:53:33 2015 +0100| [5c4b98de4d101ea715ef86847306a510afd0db0c] | committer: Anton Khirnov

h264.c: constify all uses of H264Context in slice and lower-level functions

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=5c4b98de4d101ea715ef86847306a510afd0db0c
---

 libavcodec/h264.c |   10 +++++-----
 libavcodec/h264.h |    6 +++---
 2 files changed, 8 insertions(+), 8 deletions(-)

diff --git a/libavcodec/h264.c b/libavcodec/h264.c
index 59c822c..e441a81 100644
--- a/libavcodec/h264.c
+++ b/libavcodec/h264.c
@@ -78,11 +78,11 @@ static void h264_er_decode_mb(void *opaque, int ref, int mv_dir, int mv_type,
     ff_h264_hl_decode_mb(h, &h->slice_ctx[0]);
 }
 
-void ff_h264_draw_horiz_band(H264Context *h, H264SliceContext *sl,
+void ff_h264_draw_horiz_band(const H264Context *h, H264SliceContext *sl,
                              int y, int height)
 {
     AVCodecContext *avctx = h->avctx;
-    AVFrame *cur  = &h->cur_pic.f;
+    const AVFrame   *cur  = &h->cur_pic.f;
     AVFrame *last = sl->ref_list[0][0].f.data[0] ? &sl->ref_list[0][0].f : NULL;
     const AVPixFmtDescriptor *desc = av_pix_fmt_desc_get(avctx->pix_fmt);
     int vshift = desc->log2_chroma_h;
@@ -98,7 +98,7 @@ void ff_h264_draw_horiz_band(H264Context *h, H264SliceContext *sl,
         return;
 
     if (avctx->draw_horiz_band) {
-        AVFrame *src;
+        const AVFrame *src;
         int offset[AV_NUM_DATA_POINTERS];
         int i;
 
@@ -127,7 +127,7 @@ void ff_h264_draw_horiz_band(H264Context *h, H264SliceContext *sl,
  * Check if the top & left blocks are available if needed and
  * change the dc mode so it only uses the available blocks.
  */
-int ff_h264_check_intra4x4_pred_mode(H264Context *h, H264SliceContext *sl)
+int ff_h264_check_intra4x4_pred_mode(const H264Context *h, H264SliceContext *sl)
 {
     static const int8_t top[12] = {
         -1, 0, LEFT_DC_PRED, -1, -1, -1, -1, -1, 0
@@ -174,7 +174,7 @@ int ff_h264_check_intra4x4_pred_mode(H264Context *h, H264SliceContext *sl)
  * Check if the top & left blocks are available if needed and
  * change the dc mode so it only uses the available blocks.
  */
-int ff_h264_check_intra_pred_mode(H264Context *h, H264SliceContext *sl,
+int ff_h264_check_intra_pred_mode(const H264Context *h, H264SliceContext *sl,
                                   int mode, int is_chroma)
 {
     static const int8_t top[4]  = { LEFT_DC_PRED8x8, 1, -1, -1 };
diff --git a/libavcodec/h264.h b/libavcodec/h264.h
index a226261..671a35e 100644
--- a/libavcodec/h264.h
+++ b/libavcodec/h264.h
@@ -796,13 +796,13 @@ int ff_generate_sliding_window_mmcos(H264Context *h, int first_slice);
  * Check if the top & left blocks are available if needed & change the
  * dc mode so it only uses the available blocks.
  */
-int ff_h264_check_intra4x4_pred_mode(H264Context *h, H264SliceContext *sl);
+int ff_h264_check_intra4x4_pred_mode(const H264Context *h, H264SliceContext *sl);
 
 /**
  * Check if the top & left blocks are available if needed & change the
  * dc mode so it only uses the available blocks.
  */
-int ff_h264_check_intra_pred_mode(H264Context *h, H264SliceContext *sl,
+int ff_h264_check_intra_pred_mode(const H264Context *h, H264SliceContext *sl,
                                   int mode, int is_chroma);
 
 void ff_h264_hl_decode_mb(const H264Context *h, H264SliceContext *sl);
@@ -1059,7 +1059,7 @@ void ff_h264_unref_picture(H264Context *h, H264Picture *pic);
 int ff_h264_context_init(H264Context *h);
 int ff_h264_set_parameter_from_sps(H264Context *h);
 
-void ff_h264_draw_horiz_band(H264Context *h, H264SliceContext *sl, int y, int height);
+void ff_h264_draw_horiz_band(const H264Context *h, H264SliceContext *sl, int y, int height);
 int ff_init_poc(H264Context *h, int pic_field_poc[2], int *pic_poc);
 int ff_pred_weight_table(H264Context *h, H264SliceContext *sl);
 int ff_set_ref_count(H264Context *h, H264SliceContext *sl);



More information about the ffmpeg-cvslog mailing list