[FFmpeg-cvslog] h264_loopfilter: constify all uses of H264Context

Anton Khirnov git at videolan.org
Sat Mar 21 18:58:04 CET 2015


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

h264_loopfilter: constify all uses of H264Context

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=34d4c605e9a5116d5289b35633ade5b01cacab24
---

 libavcodec/h264.h            |    4 ++--
 libavcodec/h264_loopfilter.c |   30 +++++++++++++++---------------
 2 files changed, 17 insertions(+), 17 deletions(-)

diff --git a/libavcodec/h264.h b/libavcodec/h264.h
index 6e907a4..cf4bc1e 100644
--- a/libavcodec/h264.h
+++ b/libavcodec/h264.h
@@ -831,10 +831,10 @@ void ff_h264_direct_ref_list_init(const H264Context *const h, H264SliceContext *
 void ff_h264_pred_direct_motion(const H264Context *const h, H264SliceContext *sl,
                                 int *mb_type);
 
-void ff_h264_filter_mb_fast(H264Context *h, H264SliceContext *sl, int mb_x, int mb_y,
+void ff_h264_filter_mb_fast(const H264Context *h, H264SliceContext *sl, int mb_x, int mb_y,
                             uint8_t *img_y, uint8_t *img_cb, uint8_t *img_cr,
                             unsigned int linesize, unsigned int uvlinesize);
-void ff_h264_filter_mb(H264Context *h, H264SliceContext *sl, int mb_x, int mb_y,
+void ff_h264_filter_mb(const H264Context *h, H264SliceContext *sl, int mb_x, int mb_y,
                        uint8_t *img_y, uint8_t *img_cb, uint8_t *img_cr,
                        unsigned int linesize, unsigned int uvlinesize);
 
diff --git a/libavcodec/h264_loopfilter.c b/libavcodec/h264_loopfilter.c
index c8f7a0a..c945139 100644
--- a/libavcodec/h264_loopfilter.c
+++ b/libavcodec/h264_loopfilter.c
@@ -103,7 +103,7 @@ static const uint8_t tc0_table[52*3][4] = {
 static av_always_inline void filter_mb_edgev(uint8_t *pix, int stride,
                                              const int16_t bS[4],
                                              unsigned int qp, int a, int b,
-                                             H264Context *h, int intra)
+                                             const H264Context *h, int intra)
 {
     const unsigned int index_a = qp + a;
     const int alpha = alpha_table[index_a];
@@ -125,7 +125,7 @@ static av_always_inline void filter_mb_edgev(uint8_t *pix, int stride,
 static av_always_inline void filter_mb_edgecv(uint8_t *pix, int stride,
                                               const int16_t bS[4],
                                               unsigned int qp, int a, int b,
-                                              H264Context *h, int intra)
+                                              const H264Context *h, int intra)
 {
     const unsigned int index_a = qp + a;
     const int alpha = alpha_table[index_a];
@@ -144,7 +144,7 @@ static av_always_inline void filter_mb_edgecv(uint8_t *pix, int stride,
     }
 }
 
-static av_always_inline void filter_mb_mbaff_edgev(H264Context *h, uint8_t *pix,
+static av_always_inline void filter_mb_mbaff_edgev(const H264Context *h, uint8_t *pix,
                                                    int stride,
                                                    const int16_t bS[7], int bsi,
                                                    int qp, int a, int b,
@@ -167,7 +167,7 @@ static av_always_inline void filter_mb_mbaff_edgev(H264Context *h, uint8_t *pix,
     }
 }
 
-static av_always_inline void filter_mb_mbaff_edgecv(H264Context *h,
+static av_always_inline void filter_mb_mbaff_edgecv(const H264Context *h,
                                                     uint8_t *pix, int stride,
                                                     const int16_t bS[7],
                                                     int bsi, int qp, int a,
@@ -193,7 +193,7 @@ static av_always_inline void filter_mb_mbaff_edgecv(H264Context *h,
 static av_always_inline void filter_mb_edgeh(uint8_t *pix, int stride,
                                              const int16_t bS[4],
                                              unsigned int qp, int a, int b,
-                                             H264Context *h, int intra)
+                                             const H264Context *h, int intra)
 {
     const unsigned int index_a = qp + a;
     const int alpha = alpha_table[index_a];
@@ -215,7 +215,7 @@ static av_always_inline void filter_mb_edgeh(uint8_t *pix, int stride,
 static av_always_inline void filter_mb_edgech(uint8_t *pix, int stride,
                                               const int16_t bS[4],
                                               unsigned int qp, int a, int b,
-                                              H264Context *h, int intra)
+                                              const H264Context *h, int intra)
 {
     const unsigned int index_a = qp + a;
     const int alpha = alpha_table[index_a];
@@ -234,7 +234,7 @@ static av_always_inline void filter_mb_edgech(uint8_t *pix, int stride,
     }
 }
 
-static av_always_inline void h264_filter_mb_fast_internal(H264Context *h,
+static av_always_inline void h264_filter_mb_fast_internal(const H264Context *h,
                                                           H264SliceContext *sl,
                                                           int mb_x, int mb_y,
                                                           uint8_t *img_y,
@@ -416,7 +416,7 @@ static av_always_inline void h264_filter_mb_fast_internal(H264Context *h,
     }
 }
 
-void ff_h264_filter_mb_fast(H264Context *h, H264SliceContext *sl,
+void ff_h264_filter_mb_fast(const H264Context *h, H264SliceContext *sl,
                             int mb_x, int mb_y, uint8_t *img_y,
                             uint8_t *img_cb, uint8_t *img_cr,
                             unsigned int linesize, unsigned int uvlinesize)
@@ -438,7 +438,7 @@ void ff_h264_filter_mb_fast(H264Context *h, H264SliceContext *sl,
 #endif
 }
 
-static int check_mv(H264Context *h, H264SliceContext *sl, long b_idx, long bn_idx, int mvy_limit)
+static int check_mv(H264SliceContext *sl, long b_idx, long bn_idx, int mvy_limit)
 {
     int v;
 
@@ -468,7 +468,7 @@ static int check_mv(H264Context *h, H264SliceContext *sl, long b_idx, long bn_id
     return v;
 }
 
-static av_always_inline void filter_mb_dir(H264Context *h, H264SliceContext *sl,
+static av_always_inline void filter_mb_dir(const H264Context *h, H264SliceContext *sl,
                                            int mb_x, int mb_y,
                                            uint8_t *img_y, uint8_t *img_cb, uint8_t *img_cr,
                                            unsigned int linesize, unsigned int uvlinesize,
@@ -565,7 +565,7 @@ static av_always_inline void filter_mb_dir(H264Context *h, H264SliceContext *sl,
                     int b_idx= 8 + 4;
                     int bn_idx= b_idx - (dir ? 8:1);
 
-                    bS[0] = bS[1] = bS[2] = bS[3] = check_mv(h, sl, 8 + 4, bn_idx, mvy_limit);
+                    bS[0] = bS[1] = bS[2] = bS[3] = check_mv(sl, 8 + 4, bn_idx, mvy_limit);
                     mv_done = 1;
                 }
                 else
@@ -583,7 +583,7 @@ static av_always_inline void filter_mb_dir(H264Context *h, H264SliceContext *sl,
                     }
                     else if(!mv_done)
                     {
-                        bS[i] = check_mv(h, sl, b_idx, bn_idx, mvy_limit);
+                        bS[i] = check_mv(sl, b_idx, bn_idx, mvy_limit);
                     }
                 }
             }
@@ -646,7 +646,7 @@ static av_always_inline void filter_mb_dir(H264Context *h, H264SliceContext *sl,
                 int b_idx= 8 + 4 + edge * (dir ? 8:1);
                 int bn_idx= b_idx - (dir ? 8:1);
 
-                bS[0] = bS[1] = bS[2] = bS[3] = check_mv(h, sl, b_idx, bn_idx, mvy_limit);
+                bS[0] = bS[1] = bS[2] = bS[3] = check_mv(sl, b_idx, bn_idx, mvy_limit);
                 mv_done = 1;
             }
             else
@@ -664,7 +664,7 @@ static av_always_inline void filter_mb_dir(H264Context *h, H264SliceContext *sl,
                 }
                 else if(!mv_done)
                 {
-                    bS[i] = check_mv(h, sl, b_idx, bn_idx, mvy_limit);
+                    bS[i] = check_mv(sl, b_idx, bn_idx, mvy_limit);
                 }
             }
 
@@ -712,7 +712,7 @@ static av_always_inline void filter_mb_dir(H264Context *h, H264SliceContext *sl,
     }
 }
 
-void ff_h264_filter_mb(H264Context *h, H264SliceContext *sl,
+void ff_h264_filter_mb(const H264Context *h, H264SliceContext *sl,
                        int mb_x, int mb_y,
                        uint8_t *img_y, uint8_t *img_cb, uint8_t *img_cr,
                        unsigned int linesize, unsigned int uvlinesize)



More information about the ffmpeg-cvslog mailing list