Commit 6490a0c0 authored by Anton Khirnov's avatar Anton Khirnov

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
parent 51822879
...@@ -804,7 +804,7 @@ int ff_h264_check_intra4x4_pred_mode(H264Context *h, H264SliceContext *sl); ...@@ -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 ff_h264_check_intra_pred_mode(H264Context *h, H264SliceContext *sl,
int mode, int is_chroma); 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_extradata(H264Context *h);
int ff_h264_decode_init(AVCodecContext *avctx); int ff_h264_decode_init(AVCodecContext *avctx);
void ff_h264_decode_init_vlc(void); void ff_h264_decode_init_vlc(void);
......
...@@ -36,7 +36,7 @@ ...@@ -36,7 +36,7 @@
#include "svq3.h" #include "svq3.h"
#include "thread.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, H264Picture *pic, int n,
int height, int y_offset, int list) int height, int y_offset, int list)
{ {
...@@ -50,7 +50,7 @@ static inline int get_lowest_part_list_y(H264Context *h, H264SliceContext *sl, ...@@ -50,7 +50,7 @@ static inline int get_lowest_part_list_y(H264Context *h, H264SliceContext *sl,
return FFMAX(abs(top), bottom); 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 refs[2][48], int n,
int height, int y_offset, int list0, int height, int y_offset, int list0,
int list1, int *nrefs) int list1, int *nrefs)
...@@ -68,7 +68,7 @@ static inline void get_lowest_part_y(H264Context *h, H264SliceContext *sl, ...@@ -68,7 +68,7 @@ static inline void get_lowest_part_y(H264Context *h, H264SliceContext *sl,
// Fields can wait on each other, though. // Fields can wait on each other, though.
if (ref->tf.progress->data != h->cur_pic.tf.progress->data || if (ref->tf.progress->data != h->cur_pic.tf.progress->data ||
(ref->reference & 3) != h->picture_structure) { (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) if (refs[0][ref_n] < 0)
nrefs[0] += 1; nrefs[0] += 1;
refs[0][ref_n] = FFMAX(refs[0][ref_n], my); 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, ...@@ -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 || if (ref->tf.progress->data != h->cur_pic.tf.progress->data ||
(ref->reference & 3) != h->picture_structure) { (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) if (refs[1][ref_n] < 0)
nrefs[1] += 1; nrefs[1] += 1;
refs[1][ref_n] = FFMAX(refs[1][ref_n], my); 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, ...@@ -94,7 +94,7 @@ static inline void get_lowest_part_y(H264Context *h, H264SliceContext *sl,
* *
* @param h the H264 context * @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_xy = sl->mb_xy;
const int mb_type = h->cur_pic.mb_type[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) ...@@ -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, H264Picture *pic,
int n, int square, int height, int n, int square, int height,
int delta, int list, int delta, int list,
uint8_t *dest_y, uint8_t *dest_cb, uint8_t *dest_y, uint8_t *dest_cb,
uint8_t *dest_cr, uint8_t *dest_cr,
int src_x_offset, int src_y_offset, 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, h264_chroma_mc_func chroma_op,
int pixel_shift, int chroma_idc) int pixel_shift, int chroma_idc)
{ {
...@@ -318,20 +318,20 @@ static av_always_inline void mc_dir_part(H264Context *h, H264SliceContext *sl, ...@@ -318,20 +318,20 @@ static av_always_inline void mc_dir_part(H264Context *h, H264SliceContext *sl,
mx & 7, (my << (chroma_idc == 2 /* yuv422 */)) & 7); 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 n, int square,
int height, int delta, int height, int delta,
uint8_t *dest_y, uint8_t *dest_cb, uint8_t *dest_y, uint8_t *dest_cb,
uint8_t *dest_cr, uint8_t *dest_cr,
int x_offset, int y_offset, int x_offset, int y_offset,
qpel_mc_func *qpix_put, const qpel_mc_func *qpix_put,
h264_chroma_mc_func chroma_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_chroma_mc_func chroma_avg,
int list0, int list1, int list0, int list1,
int pixel_shift, int chroma_idc) 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; h264_chroma_mc_func chroma_op = chroma_put;
dest_y += (2 * x_offset << pixel_shift) + 2 * y_offset * sl->mb_linesize; 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, ...@@ -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 n, int square,
int height, int delta, int height, int delta,
uint8_t *dest_y, uint8_t *dest_cb, uint8_t *dest_y, uint8_t *dest_cb,
uint8_t *dest_cr, uint8_t *dest_cr,
int x_offset, int y_offset, int x_offset, int y_offset,
qpel_mc_func *qpix_put, const qpel_mc_func *qpix_put,
h264_chroma_mc_func chroma_put, h264_chroma_mc_func chroma_put,
h264_weight_func luma_weight_op, h264_weight_func luma_weight_op,
h264_weight_func chroma_weight_op, h264_weight_func chroma_weight_op,
...@@ -474,7 +474,7 @@ static av_always_inline void mc_part_weighted(H264Context *h, H264SliceContext * ...@@ -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 list, int pixel_shift,
int chroma_idc) int chroma_idc)
{ {
...@@ -501,7 +501,7 @@ static av_always_inline void prefetch_motion(H264Context *h, H264SliceContext *s ...@@ -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_y,
uint8_t *src_cb, uint8_t *src_cr, uint8_t *src_cb, uint8_t *src_cr,
int linesize, int uvlinesize, int linesize, int uvlinesize,
...@@ -610,7 +610,7 @@ static av_always_inline void dctcoef_set(int16_t *mb, int high_bit_depth, ...@@ -610,7 +610,7 @@ static av_always_inline void dctcoef_set(int16_t *mb, int high_bit_depth,
AV_WN16A(mb + index, value); 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, H264SliceContext *sl,
int mb_type, int is_h264, int mb_type, int is_h264,
int simple, int simple,
...@@ -727,7 +727,7 @@ static av_always_inline void hl_decode_mb_predict_luma(H264Context *h, ...@@ -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 mb_type,
int is_h264, int simple, int is_h264, int simple,
int transform_bypass, int transform_bypass,
...@@ -810,7 +810,7 @@ static av_always_inline void hl_decode_mb_idct_luma(H264Context *h, H264SliceCon ...@@ -810,7 +810,7 @@ static av_always_inline void hl_decode_mb_idct_luma(H264Context *h, H264SliceCon
#define SIMPLE 0 #define SIMPLE 0
#include "h264_mb_template.c" #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_xy = sl->mb_xy;
const int mb_type = h->cur_pic.mb_type[mb_xy]; const int mb_type = h->cur_pic.mb_type[mb_xy];
......
...@@ -40,7 +40,7 @@ ...@@ -40,7 +40,7 @@
#define CHROMA_IDC 2 #define CHROMA_IDC 2
#include "h264_mc_template.c" #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_x = sl->mb_x;
const int mb_y = sl->mb_y; const int mb_y = sl->mb_y;
...@@ -272,7 +272,7 @@ static av_noinline void FUNC(hl_decode_mb)(H264Context *h, H264SliceContext *sl) ...@@ -272,7 +272,7 @@ static av_noinline void FUNC(hl_decode_mb)(H264Context *h, H264SliceContext *sl)
#define CHROMA_IDC 3 #define CHROMA_IDC 3
#include "h264_mc_template.c" #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_x = sl->mb_x;
const int mb_y = sl->mb_y; const int mb_y = sl->mb_y;
......
...@@ -34,18 +34,18 @@ ...@@ -34,18 +34,18 @@
#undef mc_part #undef mc_part
#define mc_part MCFUNC(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 n, int square,
int height, int delta, int height, int delta,
uint8_t *dest_y, uint8_t *dest_cb, uint8_t *dest_y, uint8_t *dest_cb,
uint8_t *dest_cr, uint8_t *dest_cr,
int x_offset, int y_offset, int x_offset, int y_offset,
qpel_mc_func *qpix_put, const qpel_mc_func *qpix_put,
h264_chroma_mc_func chroma_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_chroma_mc_func chroma_avg,
h264_weight_func *weight_op, const h264_weight_func *weight_op,
h264_biweight_func *weight_avg, const h264_biweight_func *weight_avg,
int list0, int list1) int list0, int list1)
{ {
if ((sl->use_weight == 2 && list0 && list1 && if ((sl->use_weight == 2 && list0 && list1 &&
...@@ -61,15 +61,15 @@ static void mc_part(H264Context *h, H264SliceContext *sl, ...@@ -61,15 +61,15 @@ static void mc_part(H264Context *h, H264SliceContext *sl,
chroma_avg, list0, list1, PIXEL_SHIFT, CHROMA_IDC); 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_y,
uint8_t *dest_cb, uint8_t *dest_cr, uint8_t *dest_cb, uint8_t *dest_cr,
qpel_mc_func(*qpix_put)[16], 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], qpel_mc_func(*qpix_avg)[16],
h264_chroma_mc_func(*chroma_avg), const h264_chroma_mc_func(*chroma_avg),
h264_weight_func *weight_op, const h264_weight_func *weight_op,
h264_biweight_func *weight_avg) const h264_biweight_func *weight_avg)
{ {
const int mb_xy = sl->mb_xy; const int mb_xy = sl->mb_xy;
const int mb_type = h->cur_pic.mb_type[mb_xy]; const int mb_type = h->cur_pic.mb_type[mb_xy];
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment