avcodec/vp9dec: Constify VP9TileData->VP9Context pointer target

This is possible now that ff_thread_await_progress() accepts
a const ThreadFrame*.

Reviewed-by: Ronald S. Bultje <rsbultje@gmail.com>
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
pull/388/head
Andreas Rheinhardt 2 years ago
parent 0eb399ac39
commit 4368e86a02
  1. 2
      libavcodec/vp9_mc_template.c
  2. 30
      libavcodec/vp9block.c
  3. 4
      libavcodec/vp9dec.h
  4. 6
      libavcodec/vp9mvs.c
  5. 22
      libavcodec/vp9recon.c

@ -33,7 +33,7 @@ static void FN(inter_pred)(VP9TileData *td)
{ 0, 0, 1, 1, 1, 2, 2, 2, 3, 3, 3, 4, 4 }, { 0, 0, 1, 1, 1, 2, 2, 2, 3, 3, 3, 4, 4 },
{ 1, 1, 2, 2, 2, 3, 3, 3, 4, 4, 4, 4, 4 }, { 1, 1, 2, 2, 2, 3, 3, 3, 4, 4, 4, 4, 4 },
}; };
VP9Context *s = td->s; const VP9Context *s = td->s;
VP9Block *b = td->b; VP9Block *b = td->b;
int row = td->row, col = td->col; int row = td->row, col = td->col;
const ThreadFrame *tref1 = &s->s.refs[s->s.h.refidx[b->ref[0]]], *tref2; const ThreadFrame *tref1 = &s->s.refs[s->s.h.refidx[b->ref[0]]], *tref2;

@ -88,7 +88,7 @@ static void decode_mode(VP9TileData *td)
TX_32X32, TX_32X32, TX_32X32, TX_32X32, TX_16X16, TX_16X16, TX_32X32, TX_32X32, TX_32X32, TX_32X32, TX_16X16, TX_16X16,
TX_16X16, TX_8X8, TX_8X8, TX_8X8, TX_4X4, TX_4X4, TX_4X4 TX_16X16, TX_8X8, TX_8X8, TX_8X8, TX_4X4, TX_4X4, TX_4X4
}; };
VP9Context *s = td->s; const VP9Context *s = td->s;
VP9Block *b = td->b; VP9Block *b = td->b;
int row = td->row, col = td->col, row7 = td->row7; int row = td->row, col = td->col, row7 = td->row7;
enum TxfmMode max_tx = max_tx_for_bl_bp[b->bs]; enum TxfmMode max_tx = max_tx_for_bl_bp[b->bs];
@ -804,9 +804,9 @@ static void decode_mode(VP9TileData *td)
static av_always_inline int static av_always_inline int
decode_coeffs_b_generic(VPXRangeCoder *c, int16_t *coef, int n_coeffs, decode_coeffs_b_generic(VPXRangeCoder *c, int16_t *coef, int n_coeffs,
int is_tx32x32, int is8bitsperpixel, int bpp, unsigned (*cnt)[6][3], int is_tx32x32, int is8bitsperpixel, int bpp, unsigned (*cnt)[6][3],
unsigned (*eob)[6][2], uint8_t (*p)[6][11], unsigned (*eob)[6][2], const uint8_t (*p)[6][11],
int nnz, const int16_t *scan, const int16_t (*nb)[2], int nnz, const int16_t *scan, const int16_t (*nb)[2],
const int16_t *band_counts, int16_t *qmul) const int16_t *band_counts, const int16_t *qmul)
{ {
int i = 0, band = 0, band_left = band_counts[band]; int i = 0, band = 0, band_left = band_counts[band];
const uint8_t *tp = p[0][nnz]; const uint8_t *tp = p[0][nnz];
@ -923,9 +923,9 @@ skip_eob:
static int decode_coeffs_b_8bpp(VP9TileData *td, int16_t *coef, int n_coeffs, static int decode_coeffs_b_8bpp(VP9TileData *td, int16_t *coef, int n_coeffs,
unsigned (*cnt)[6][3], unsigned (*eob)[6][2], unsigned (*cnt)[6][3], unsigned (*eob)[6][2],
uint8_t (*p)[6][11], int nnz, const int16_t *scan, const uint8_t (*p)[6][11], int nnz, const int16_t *scan,
const int16_t (*nb)[2], const int16_t *band_counts, const int16_t (*nb)[2], const int16_t *band_counts,
int16_t *qmul) const int16_t *qmul)
{ {
return decode_coeffs_b_generic(td->c, coef, n_coeffs, 0, 1, 8, cnt, eob, p, return decode_coeffs_b_generic(td->c, coef, n_coeffs, 0, 1, 8, cnt, eob, p,
nnz, scan, nb, band_counts, qmul); nnz, scan, nb, band_counts, qmul);
@ -933,9 +933,9 @@ static int decode_coeffs_b_8bpp(VP9TileData *td, int16_t *coef, int n_coeffs,
static int decode_coeffs_b32_8bpp(VP9TileData *td, int16_t *coef, int n_coeffs, static int decode_coeffs_b32_8bpp(VP9TileData *td, int16_t *coef, int n_coeffs,
unsigned (*cnt)[6][3], unsigned (*eob)[6][2], unsigned (*cnt)[6][3], unsigned (*eob)[6][2],
uint8_t (*p)[6][11], int nnz, const int16_t *scan, const uint8_t (*p)[6][11], int nnz, const int16_t *scan,
const int16_t (*nb)[2], const int16_t *band_counts, const int16_t (*nb)[2], const int16_t *band_counts,
int16_t *qmul) const int16_t *qmul)
{ {
return decode_coeffs_b_generic(td->c, coef, n_coeffs, 1, 1, 8, cnt, eob, p, return decode_coeffs_b_generic(td->c, coef, n_coeffs, 1, 1, 8, cnt, eob, p,
nnz, scan, nb, band_counts, qmul); nnz, scan, nb, band_counts, qmul);
@ -943,9 +943,9 @@ static int decode_coeffs_b32_8bpp(VP9TileData *td, int16_t *coef, int n_coeffs,
static int decode_coeffs_b_16bpp(VP9TileData *td, int16_t *coef, int n_coeffs, static int decode_coeffs_b_16bpp(VP9TileData *td, int16_t *coef, int n_coeffs,
unsigned (*cnt)[6][3], unsigned (*eob)[6][2], unsigned (*cnt)[6][3], unsigned (*eob)[6][2],
uint8_t (*p)[6][11], int nnz, const int16_t *scan, const uint8_t (*p)[6][11], int nnz, const int16_t *scan,
const int16_t (*nb)[2], const int16_t *band_counts, const int16_t (*nb)[2], const int16_t *band_counts,
int16_t *qmul) const int16_t *qmul)
{ {
return decode_coeffs_b_generic(td->c, coef, n_coeffs, 0, 0, td->s->s.h.bpp, cnt, eob, p, return decode_coeffs_b_generic(td->c, coef, n_coeffs, 0, 0, td->s->s.h.bpp, cnt, eob, p,
nnz, scan, nb, band_counts, qmul); nnz, scan, nb, band_counts, qmul);
@ -953,9 +953,9 @@ static int decode_coeffs_b_16bpp(VP9TileData *td, int16_t *coef, int n_coeffs,
static int decode_coeffs_b32_16bpp(VP9TileData *td, int16_t *coef, int n_coeffs, static int decode_coeffs_b32_16bpp(VP9TileData *td, int16_t *coef, int n_coeffs,
unsigned (*cnt)[6][3], unsigned (*eob)[6][2], unsigned (*cnt)[6][3], unsigned (*eob)[6][2],
uint8_t (*p)[6][11], int nnz, const int16_t *scan, const uint8_t (*p)[6][11], int nnz, const int16_t *scan,
const int16_t (*nb)[2], const int16_t *band_counts, const int16_t (*nb)[2], const int16_t *band_counts,
int16_t *qmul) const int16_t *qmul)
{ {
return decode_coeffs_b_generic(td->c, coef, n_coeffs, 1, 0, td->s->s.h.bpp, cnt, eob, p, return decode_coeffs_b_generic(td->c, coef, n_coeffs, 1, 0, td->s->s.h.bpp, cnt, eob, p,
nnz, scan, nb, band_counts, qmul); nnz, scan, nb, band_counts, qmul);
@ -963,17 +963,17 @@ static int decode_coeffs_b32_16bpp(VP9TileData *td, int16_t *coef, int n_coeffs,
static av_always_inline int decode_coeffs(VP9TileData *td, int is8bitsperpixel) static av_always_inline int decode_coeffs(VP9TileData *td, int is8bitsperpixel)
{ {
VP9Context *s = td->s; const VP9Context *s = td->s;
VP9Block *b = td->b; VP9Block *b = td->b;
int row = td->row, col = td->col; int row = td->row, col = td->col;
uint8_t (*p)[6][11] = s->prob.coef[b->tx][0 /* y */][!b->intra]; const uint8_t (*p)[6][11] = s->prob.coef[b->tx][0 /* y */][!b->intra];
unsigned (*c)[6][3] = td->counts.coef[b->tx][0 /* y */][!b->intra]; unsigned (*c)[6][3] = td->counts.coef[b->tx][0 /* y */][!b->intra];
unsigned (*e)[6][2] = td->counts.eob[b->tx][0 /* y */][!b->intra]; unsigned (*e)[6][2] = td->counts.eob[b->tx][0 /* y */][!b->intra];
int w4 = ff_vp9_bwh_tab[1][b->bs][0] << 1, h4 = ff_vp9_bwh_tab[1][b->bs][1] << 1; int w4 = ff_vp9_bwh_tab[1][b->bs][0] << 1, h4 = ff_vp9_bwh_tab[1][b->bs][1] << 1;
int end_x = FFMIN(2 * (s->cols - col), w4); int end_x = FFMIN(2 * (s->cols - col), w4);
int end_y = FFMIN(2 * (s->rows - row), h4); int end_y = FFMIN(2 * (s->rows - row), h4);
int n, pl, x, y, ret; int n, pl, x, y, ret;
int16_t (*qmul)[2] = s->s.h.segmentation.feat[b->seg_id].qmul; const int16_t (*qmul)[2] = s->s.h.segmentation.feat[b->seg_id].qmul;
int tx = 4 * s->s.h.lossless + b->tx; int tx = 4 * s->s.h.lossless + b->tx;
const int16_t * const *yscans = ff_vp9_scans[tx]; const int16_t * const *yscans = ff_vp9_scans[tx];
const int16_t (* const * ynbs)[2] = ff_vp9_scans_nb[tx]; const int16_t (* const * ynbs)[2] = ff_vp9_scans_nb[tx];
@ -1264,7 +1264,7 @@ void ff_vp9_decode_block(VP9TileData *td, int row, int col,
VP9Filter *lflvl, ptrdiff_t yoff, ptrdiff_t uvoff, VP9Filter *lflvl, ptrdiff_t yoff, ptrdiff_t uvoff,
enum BlockLevel bl, enum BlockPartition bp) enum BlockLevel bl, enum BlockPartition bp)
{ {
VP9Context *s = td->s; const VP9Context *s = td->s;
VP9Block *b = td->b; VP9Block *b = td->b;
enum BlockSize bs = bl * 3 + bp; enum BlockSize bs = bl * 3 + bp;
int bytesperpixel = s->bytesperpixel; int bytesperpixel = s->bytesperpixel;

@ -166,9 +166,7 @@ typedef struct VP9Context {
} VP9Context; } VP9Context;
struct VP9TileData { struct VP9TileData {
//VP9Context should be const, but because of the threading API(generates const VP9Context *s;
//a lot of warnings) it's not.
VP9Context *s;
VPXRangeCoder *c_b; VPXRangeCoder *c_b;
VPXRangeCoder *c; VPXRangeCoder *c;
int row, row7, col, col7; int row, row7, col, col7;

@ -65,7 +65,7 @@ static void find_ref_mvs(VP9TileData *td,
[BS_4x4] = { { 0, -1 }, { -1, 0 }, { -1, -1 }, { 0, -2 }, [BS_4x4] = { { 0, -1 }, { -1, 0 }, { -1, -1 }, { 0, -2 },
{ -2, 0 }, { -1, -2 }, { -2, -1 }, { -2, -2 } }, { -2, 0 }, { -1, -2 }, { -2, -1 }, { -2, -2 } },
}; };
VP9Context *s = td->s; const VP9Context *s = td->s;
VP9Block *b = td->b; VP9Block *b = td->b;
int row = td->row, col = td->col, row7 = td->row7; int row = td->row, col = td->col, row7 = td->row7;
const int8_t (*p)[2] = mv_ref_blk_off[b->bs]; const int8_t (*p)[2] = mv_ref_blk_off[b->bs];
@ -235,7 +235,7 @@ static void find_ref_mvs(VP9TileData *td,
static av_always_inline int read_mv_component(VP9TileData *td, int idx, int hp) static av_always_inline int read_mv_component(VP9TileData *td, int idx, int hp)
{ {
VP9Context *s = td->s; const VP9Context *s = td->s;
int bit, sign = vpx_rac_get_prob(td->c, s->prob.p.mv_comp[idx].sign); int bit, sign = vpx_rac_get_prob(td->c, s->prob.p.mv_comp[idx].sign);
int n, c = vp89_rac_get_tree(td->c, ff_vp9_mv_class_tree, int n, c = vp89_rac_get_tree(td->c, ff_vp9_mv_class_tree,
s->prob.p.mv_comp[idx].classes); s->prob.p.mv_comp[idx].classes);
@ -290,7 +290,7 @@ static av_always_inline int read_mv_component(VP9TileData *td, int idx, int hp)
void ff_vp9_fill_mv(VP9TileData *td, VP9mv *mv, int mode, int sb) void ff_vp9_fill_mv(VP9TileData *td, VP9mv *mv, int mode, int sb)
{ {
VP9Context *s = td->s; const VP9Context *s = td->s;
VP9Block *b = td->b; VP9Block *b = td->b;
if (mode == ZEROMV) { if (mode == ZEROMV) {

@ -36,7 +36,7 @@ static av_always_inline int check_intra_mode(VP9TileData *td, int mode, uint8_t
int row, int y, enum TxfmMode tx, int row, int y, enum TxfmMode tx,
int p, int ss_h, int ss_v, int bytesperpixel) int p, int ss_h, int ss_v, int bytesperpixel)
{ {
VP9Context *s = td->s; const VP9Context *s = td->s;
int have_top = row > 0 || y > 0; int have_top = row > 0 || y > 0;
int have_left = col > td->tile_col_start || x > 0; int have_left = col > td->tile_col_start || x > 0;
int have_right = x < w - 1; int have_right = x < w - 1;
@ -218,7 +218,7 @@ static av_always_inline int check_intra_mode(VP9TileData *td, int mode, uint8_t
static av_always_inline void intra_recon(VP9TileData *td, ptrdiff_t y_off, static av_always_inline void intra_recon(VP9TileData *td, ptrdiff_t y_off,
ptrdiff_t uv_off, int bytesperpixel) ptrdiff_t uv_off, int bytesperpixel)
{ {
VP9Context *s = td->s; const VP9Context *s = td->s;
VP9Block *b = td->b; VP9Block *b = td->b;
int row = td->row, col = td->col; int row = td->row, col = td->col;
int w4 = ff_vp9_bwh_tab[1][b->bs][0] << 1, step1d = 1 << b->tx, n; int w4 = ff_vp9_bwh_tab[1][b->bs][0] << 1, step1d = 1 << b->tx, n;
@ -295,14 +295,14 @@ void ff_vp9_intra_recon_16bpp(VP9TileData *td, ptrdiff_t y_off, ptrdiff_t uv_off
intra_recon(td, y_off, uv_off, 2); intra_recon(td, y_off, uv_off, 2);
} }
static av_always_inline void mc_luma_unscaled(VP9TileData *td, vp9_mc_func (*mc)[2], static av_always_inline void mc_luma_unscaled(VP9TileData *td, const vp9_mc_func (*mc)[2],
uint8_t *dst, ptrdiff_t dst_stride, uint8_t *dst, ptrdiff_t dst_stride,
const uint8_t *ref, ptrdiff_t ref_stride, const uint8_t *ref, ptrdiff_t ref_stride,
const ThreadFrame *ref_frame, const ThreadFrame *ref_frame,
ptrdiff_t y, ptrdiff_t x, const VP9mv *mv, ptrdiff_t y, ptrdiff_t x, const VP9mv *mv,
int bw, int bh, int w, int h, int bytesperpixel) int bw, int bh, int w, int h, int bytesperpixel)
{ {
VP9Context *s = td->s; const VP9Context *s = td->s;
int mx = mv->x, my = mv->y, th; int mx = mv->x, my = mv->y, th;
y += my >> 3; y += my >> 3;
@ -331,7 +331,7 @@ static av_always_inline void mc_luma_unscaled(VP9TileData *td, vp9_mc_func (*mc)
mc[!!mx][!!my](dst, dst_stride, ref, ref_stride, bh, mx << 1, my << 1); mc[!!mx][!!my](dst, dst_stride, ref, ref_stride, bh, mx << 1, my << 1);
} }
static av_always_inline void mc_chroma_unscaled(VP9TileData *td, vp9_mc_func (*mc)[2], static av_always_inline void mc_chroma_unscaled(VP9TileData *td, const vp9_mc_func (*mc)[2],
uint8_t *dst_u, uint8_t *dst_v, uint8_t *dst_u, uint8_t *dst_v,
ptrdiff_t dst_stride, ptrdiff_t dst_stride,
const uint8_t *ref_u, ptrdiff_t src_stride_u, const uint8_t *ref_u, ptrdiff_t src_stride_u,
@ -340,7 +340,7 @@ static av_always_inline void mc_chroma_unscaled(VP9TileData *td, vp9_mc_func (*m
ptrdiff_t y, ptrdiff_t x, const VP9mv *mv, ptrdiff_t y, ptrdiff_t x, const VP9mv *mv,
int bw, int bh, int w, int h, int bytesperpixel) int bw, int bh, int w, int h, int bytesperpixel)
{ {
VP9Context *s = td->s; const VP9Context *s = td->s;
int mx = mv->x * (1 << !s->ss_h), my = mv->y * (1 << !s->ss_v), th; int mx = mv->x * (1 << !s->ss_h), my = mv->y * (1 << !s->ss_v), th;
y += my >> 4; y += my >> 4;
@ -404,7 +404,7 @@ static av_always_inline void mc_chroma_unscaled(VP9TileData *td, vp9_mc_func (*m
#undef SCALED #undef SCALED
static av_always_inline void mc_luma_scaled(VP9TileData *td, vp9_scaled_mc_func smc, static av_always_inline void mc_luma_scaled(VP9TileData *td, vp9_scaled_mc_func smc,
vp9_mc_func (*mc)[2], const vp9_mc_func (*mc)[2],
uint8_t *dst, ptrdiff_t dst_stride, uint8_t *dst, ptrdiff_t dst_stride,
const uint8_t *ref, ptrdiff_t ref_stride, const uint8_t *ref, ptrdiff_t ref_stride,
const ThreadFrame *ref_frame, const ThreadFrame *ref_frame,
@ -413,7 +413,7 @@ static av_always_inline void mc_luma_scaled(VP9TileData *td, vp9_scaled_mc_func
int bw, int bh, int w, int h, int bytesperpixel, int bw, int bh, int w, int h, int bytesperpixel,
const uint16_t *scale, const uint8_t *step) const uint16_t *scale, const uint8_t *step)
{ {
VP9Context *s = td->s; const VP9Context *s = td->s;
if (s->s.frames[CUR_FRAME].tf.f->width == ref_frame->f->width && if (s->s.frames[CUR_FRAME].tf.f->width == ref_frame->f->width &&
s->s.frames[CUR_FRAME].tf.f->height == ref_frame->f->height) { s->s.frames[CUR_FRAME].tf.f->height == ref_frame->f->height) {
mc_luma_unscaled(td, mc, dst, dst_stride, ref, ref_stride, ref_frame, mc_luma_unscaled(td, mc, dst, dst_stride, ref, ref_stride, ref_frame,
@ -462,7 +462,7 @@ static av_always_inline void mc_luma_scaled(VP9TileData *td, vp9_scaled_mc_func
} }
static av_always_inline void mc_chroma_scaled(VP9TileData *td, vp9_scaled_mc_func smc, static av_always_inline void mc_chroma_scaled(VP9TileData *td, vp9_scaled_mc_func smc,
vp9_mc_func (*mc)[2], const vp9_mc_func (*mc)[2],
uint8_t *dst_u, uint8_t *dst_v, uint8_t *dst_u, uint8_t *dst_v,
ptrdiff_t dst_stride, ptrdiff_t dst_stride,
const uint8_t *ref_u, ptrdiff_t src_stride_u, const uint8_t *ref_u, ptrdiff_t src_stride_u,
@ -473,7 +473,7 @@ static av_always_inline void mc_chroma_scaled(VP9TileData *td, vp9_scaled_mc_fun
int bw, int bh, int w, int h, int bytesperpixel, int bw, int bh, int w, int h, int bytesperpixel,
const uint16_t *scale, const uint8_t *step) const uint16_t *scale, const uint8_t *step)
{ {
VP9Context *s = td->s; const VP9Context *s = td->s;
if (s->s.frames[CUR_FRAME].tf.f->width == ref_frame->f->width && if (s->s.frames[CUR_FRAME].tf.f->width == ref_frame->f->width &&
s->s.frames[CUR_FRAME].tf.f->height == ref_frame->f->height) { s->s.frames[CUR_FRAME].tf.f->height == ref_frame->f->height) {
mc_chroma_unscaled(td, mc, dst_u, dst_v, dst_stride, ref_u, src_stride_u, mc_chroma_unscaled(td, mc, dst_u, dst_v, dst_stride, ref_u, src_stride_u,
@ -568,7 +568,7 @@ static av_always_inline void mc_chroma_scaled(VP9TileData *td, vp9_scaled_mc_fun
static av_always_inline void inter_recon(VP9TileData *td, int bytesperpixel) static av_always_inline void inter_recon(VP9TileData *td, int bytesperpixel)
{ {
VP9Context *s = td->s; const VP9Context *s = td->s;
VP9Block *b = td->b; VP9Block *b = td->b;
int row = td->row, col = td->col; int row = td->row, col = td->col;

Loading…
Cancel
Save