From 6490a0c0fbe0e55f765ea2aa2e8495181ea1f719 Mon Sep 17 00:00:00 2001 From: Anton Khirnov Date: Tue, 27 Jan 2015 15:53:33 +0100 Subject: h264_mb: 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 --- libavcodec/h264.h | 2 +- libavcodec/h264_mb.c | 36 ++++++++++++++++++------------------ libavcodec/h264_mb_template.c | 4 ++-- libavcodec/h264_mc_template.c | 20 ++++++++++---------- 4 files changed, 31 insertions(+), 31 deletions(-) (limited to 'libavcodec') diff --git a/libavcodec/h264.h b/libavcodec/h264.h index 42bab1b4b2..57d21328f4 100644 --- a/libavcodec/h264.h +++ b/libavcodec/h264.h @@ -804,7 +804,7 @@ int ff_h264_check_intra4x4_pred_mode(H264Context *h, H264SliceContext *sl); int ff_h264_check_intra_pred_mode(H264Context *h, H264SliceContext *sl, int mode, int is_chroma); -void ff_h264_hl_decode_mb(H264Context *h, H264SliceContext *sl); +void ff_h264_hl_decode_mb(const H264Context *h, H264SliceContext *sl); int ff_h264_decode_extradata(H264Context *h); int ff_h264_decode_init(AVCodecContext *avctx); void ff_h264_decode_init_vlc(void); diff --git a/libavcodec/h264_mb.c b/libavcodec/h264_mb.c index cfe975e4dc..972fe14bdc 100644 --- a/libavcodec/h264_mb.c +++ b/libavcodec/h264_mb.c @@ -36,7 +36,7 @@ #include "svq3.h" #include "thread.h" -static inline int get_lowest_part_list_y(H264Context *h, H264SliceContext *sl, +static inline int get_lowest_part_list_y(H264SliceContext *sl, H264Picture *pic, int n, int height, int y_offset, int list) { @@ -50,7 +50,7 @@ static inline int get_lowest_part_list_y(H264Context *h, H264SliceContext *sl, return FFMAX(abs(top), bottom); } -static inline void get_lowest_part_y(H264Context *h, H264SliceContext *sl, +static inline void get_lowest_part_y(const H264Context *h, H264SliceContext *sl, int refs[2][48], int n, int height, int y_offset, int list0, int list1, int *nrefs) @@ -68,7 +68,7 @@ static inline void get_lowest_part_y(H264Context *h, H264SliceContext *sl, // Fields can wait on each other, though. if (ref->tf.progress->data != h->cur_pic.tf.progress->data || (ref->reference & 3) != h->picture_structure) { - my = get_lowest_part_list_y(h, sl, ref, n, height, y_offset, 0); + my = get_lowest_part_list_y(sl, ref, n, height, y_offset, 0); if (refs[0][ref_n] < 0) nrefs[0] += 1; refs[0][ref_n] = FFMAX(refs[0][ref_n], my); @@ -81,7 +81,7 @@ static inline void get_lowest_part_y(H264Context *h, H264SliceContext *sl, if (ref->tf.progress->data != h->cur_pic.tf.progress->data || (ref->reference & 3) != h->picture_structure) { - my = get_lowest_part_list_y(h, sl, ref, n, height, y_offset, 1); + my = get_lowest_part_list_y(sl, ref, n, height, y_offset, 1); if (refs[1][ref_n] < 0) nrefs[1] += 1; refs[1][ref_n] = FFMAX(refs[1][ref_n], my); @@ -94,7 +94,7 @@ static inline void get_lowest_part_y(H264Context *h, H264SliceContext *sl, * * @param h the H264 context */ -static void await_references(H264Context *h, H264SliceContext *sl) +static void await_references(const H264Context *h, H264SliceContext *sl) { const int mb_xy = sl->mb_xy; const int mb_type = h->cur_pic.mb_type[mb_xy]; @@ -202,14 +202,14 @@ static void await_references(H264Context *h, H264SliceContext *sl) } } -static av_always_inline void mc_dir_part(H264Context *h, H264SliceContext *sl, +static av_always_inline void mc_dir_part(const H264Context *h, H264SliceContext *sl, H264Picture *pic, int n, int square, int height, int delta, int list, uint8_t *dest_y, uint8_t *dest_cb, uint8_t *dest_cr, int src_x_offset, int src_y_offset, - qpel_mc_func *qpix_op, + const qpel_mc_func *qpix_op, h264_chroma_mc_func chroma_op, int pixel_shift, int chroma_idc) { @@ -318,20 +318,20 @@ static av_always_inline void mc_dir_part(H264Context *h, H264SliceContext *sl, mx & 7, (my << (chroma_idc == 2 /* yuv422 */)) & 7); } -static av_always_inline void mc_part_std(H264Context *h, H264SliceContext *sl, +static av_always_inline void mc_part_std(const H264Context *h, H264SliceContext *sl, int n, int square, int height, int delta, uint8_t *dest_y, uint8_t *dest_cb, uint8_t *dest_cr, int x_offset, int y_offset, - qpel_mc_func *qpix_put, + const qpel_mc_func *qpix_put, h264_chroma_mc_func chroma_put, - qpel_mc_func *qpix_avg, + const qpel_mc_func *qpix_avg, h264_chroma_mc_func chroma_avg, int list0, int list1, int pixel_shift, int chroma_idc) { - qpel_mc_func *qpix_op = qpix_put; + const qpel_mc_func *qpix_op = qpix_put; h264_chroma_mc_func chroma_op = chroma_put; dest_y += (2 * x_offset << pixel_shift) + 2 * y_offset * sl->mb_linesize; @@ -366,13 +366,13 @@ static av_always_inline void mc_part_std(H264Context *h, H264SliceContext *sl, } } -static av_always_inline void mc_part_weighted(H264Context *h, H264SliceContext *sl, +static av_always_inline void mc_part_weighted(const H264Context *h, H264SliceContext *sl, int n, int square, int height, int delta, uint8_t *dest_y, uint8_t *dest_cb, uint8_t *dest_cr, int x_offset, int y_offset, - qpel_mc_func *qpix_put, + const qpel_mc_func *qpix_put, h264_chroma_mc_func chroma_put, h264_weight_func luma_weight_op, h264_weight_func chroma_weight_op, @@ -474,7 +474,7 @@ static av_always_inline void mc_part_weighted(H264Context *h, H264SliceContext * } } -static av_always_inline void prefetch_motion(H264Context *h, H264SliceContext *sl, +static av_always_inline void prefetch_motion(const H264Context *h, H264SliceContext *sl, int list, int pixel_shift, int chroma_idc) { @@ -501,7 +501,7 @@ static av_always_inline void prefetch_motion(H264Context *h, H264SliceContext *s } } -static av_always_inline void xchg_mb_border(H264Context *h, H264SliceContext *sl, +static av_always_inline void xchg_mb_border(const H264Context *h, H264SliceContext *sl, uint8_t *src_y, uint8_t *src_cb, uint8_t *src_cr, int linesize, int uvlinesize, @@ -610,7 +610,7 @@ static av_always_inline void dctcoef_set(int16_t *mb, int high_bit_depth, AV_WN16A(mb + index, value); } -static av_always_inline void hl_decode_mb_predict_luma(H264Context *h, +static av_always_inline void hl_decode_mb_predict_luma(const H264Context *h, H264SliceContext *sl, int mb_type, int is_h264, int simple, @@ -727,7 +727,7 @@ static av_always_inline void hl_decode_mb_predict_luma(H264Context *h, } } -static av_always_inline void hl_decode_mb_idct_luma(H264Context *h, H264SliceContext *sl, +static av_always_inline void hl_decode_mb_idct_luma(const H264Context *h, H264SliceContext *sl, int mb_type, int is_h264, int simple, int transform_bypass, @@ -810,7 +810,7 @@ static av_always_inline void hl_decode_mb_idct_luma(H264Context *h, H264SliceCon #define SIMPLE 0 #include "h264_mb_template.c" -void ff_h264_hl_decode_mb(H264Context *h, H264SliceContext *sl) +void ff_h264_hl_decode_mb(const H264Context *h, H264SliceContext *sl) { const int mb_xy = sl->mb_xy; const int mb_type = h->cur_pic.mb_type[mb_xy]; diff --git a/libavcodec/h264_mb_template.c b/libavcodec/h264_mb_template.c index 4689d62bca..7396327178 100644 --- a/libavcodec/h264_mb_template.c +++ b/libavcodec/h264_mb_template.c @@ -40,7 +40,7 @@ #define CHROMA_IDC 2 #include "h264_mc_template.c" -static av_noinline void FUNC(hl_decode_mb)(H264Context *h, H264SliceContext *sl) +static av_noinline void FUNC(hl_decode_mb)(const H264Context *h, H264SliceContext *sl) { const int mb_x = sl->mb_x; const int mb_y = sl->mb_y; @@ -272,7 +272,7 @@ static av_noinline void FUNC(hl_decode_mb)(H264Context *h, H264SliceContext *sl) #define CHROMA_IDC 3 #include "h264_mc_template.c" -static av_noinline void FUNC(hl_decode_mb_444)(H264Context *h, H264SliceContext *sl) +static av_noinline void FUNC(hl_decode_mb_444)(const H264Context *h, H264SliceContext *sl) { const int mb_x = sl->mb_x; const int mb_y = sl->mb_y; diff --git a/libavcodec/h264_mc_template.c b/libavcodec/h264_mc_template.c index f1f906f729..a2958598ab 100644 --- a/libavcodec/h264_mc_template.c +++ b/libavcodec/h264_mc_template.c @@ -34,18 +34,18 @@ #undef mc_part #define mc_part MCFUNC(mc_part) -static void mc_part(H264Context *h, H264SliceContext *sl, +static void mc_part(const H264Context *h, H264SliceContext *sl, int n, int square, int height, int delta, uint8_t *dest_y, uint8_t *dest_cb, uint8_t *dest_cr, int x_offset, int y_offset, - qpel_mc_func *qpix_put, + const qpel_mc_func *qpix_put, h264_chroma_mc_func chroma_put, - qpel_mc_func *qpix_avg, + const qpel_mc_func *qpix_avg, h264_chroma_mc_func chroma_avg, - h264_weight_func *weight_op, - h264_biweight_func *weight_avg, + const h264_weight_func *weight_op, + const h264_biweight_func *weight_avg, int list0, int list1) { if ((sl->use_weight == 2 && list0 && list1 && @@ -61,15 +61,15 @@ static void mc_part(H264Context *h, H264SliceContext *sl, chroma_avg, list0, list1, PIXEL_SHIFT, CHROMA_IDC); } -static void MCFUNC(hl_motion)(H264Context *h, H264SliceContext *sl, +static void MCFUNC(hl_motion)(const H264Context *h, H264SliceContext *sl, uint8_t *dest_y, uint8_t *dest_cb, uint8_t *dest_cr, qpel_mc_func(*qpix_put)[16], - h264_chroma_mc_func(*chroma_put), + const h264_chroma_mc_func(*chroma_put), qpel_mc_func(*qpix_avg)[16], - h264_chroma_mc_func(*chroma_avg), - h264_weight_func *weight_op, - h264_biweight_func *weight_avg) + const h264_chroma_mc_func(*chroma_avg), + const h264_weight_func *weight_op, + const h264_biweight_func *weight_avg) { const int mb_xy = sl->mb_xy; const int mb_type = h->cur_pic.mb_type[mb_xy]; -- cgit v1.2.3