From: Andreas Rheinhardt <andreas.rheinhardt@outlook.com> To: ffmpeg-devel@ffmpeg.org Cc: Andreas Rheinhardt <andreas.rheinhardt@outlook.com> Subject: [FFmpeg-devel] [PATCH 05/39] avcodec/vp9dec: Constify VP9TileData->VP9Context pointer target Date: Wed, 27 Jul 2022 00:07:40 +0200 Message-ID: <DB6PR0101MB22143F825F1E13EEAC85E32D8F949@DB6PR0101MB2214.eurprd01.prod.exchangelabs.com> (raw) In-Reply-To: <DB6PR0101MB22140CEE765FDFAB596653698F949@DB6PR0101MB2214.eurprd01.prod.exchangelabs.com> This is possible now that ff_thread_await_progress() accepts a const ThreadFrame*. Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com> --- libavcodec/vp9_mc_template.c | 2 +- libavcodec/vp9block.c | 30 +++++++++++++++--------------- libavcodec/vp9dec.h | 4 +--- libavcodec/vp9mvs.c | 6 +++--- libavcodec/vp9recon.c | 22 +++++++++++----------- 5 files changed, 31 insertions(+), 33 deletions(-) diff --git a/libavcodec/vp9_mc_template.c b/libavcodec/vp9_mc_template.c index d0c12e81f1..9337edcbdb 100644 --- a/libavcodec/vp9_mc_template.c +++ b/libavcodec/vp9_mc_template.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 }, { 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; int row = td->row, col = td->col; const ThreadFrame *tref1 = &s->s.refs[s->s.h.refidx[b->ref[0]]], *tref2; diff --git a/libavcodec/vp9block.c b/libavcodec/vp9block.c index 5fdda63545..5d498f0a95 100644 --- a/libavcodec/vp9block.c +++ b/libavcodec/vp9block.c @@ -87,7 +87,7 @@ static void decode_mode(VP9TileData *td) 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 }; - VP9Context *s = td->s; + const VP9Context *s = td->s; VP9Block *b = td->b; int row = td->row, col = td->col, row7 = td->row7; enum TxfmMode max_tx = max_tx_for_bl_bp[b->bs]; @@ -802,9 +802,9 @@ static void decode_mode(VP9TileData *td) static av_always_inline int decode_coeffs_b_generic(VP56RangeCoder *c, int16_t *coef, int n_coeffs, 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], - 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]; const uint8_t *tp = p[0][nnz]; @@ -921,9 +921,9 @@ skip_eob: static int decode_coeffs_b_8bpp(VP9TileData *td, int16_t *coef, int n_coeffs, 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, - int16_t *qmul) + const int16_t *qmul) { return decode_coeffs_b_generic(td->c, coef, n_coeffs, 0, 1, 8, cnt, eob, p, nnz, scan, nb, band_counts, qmul); @@ -931,9 +931,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, 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, - int16_t *qmul) + const int16_t *qmul) { return decode_coeffs_b_generic(td->c, coef, n_coeffs, 1, 1, 8, cnt, eob, p, nnz, scan, nb, band_counts, qmul); @@ -941,9 +941,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, 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, - 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, nnz, scan, nb, band_counts, qmul); @@ -951,9 +951,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, 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, - 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, nnz, scan, nb, band_counts, qmul); @@ -961,17 +961,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) { - VP9Context *s = td->s; + const VP9Context *s = td->s; VP9Block *b = td->b; 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 (*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 end_x = FFMIN(2 * (s->cols - col), w4); int end_y = FFMIN(2 * (s->rows - row), h4); 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; const int16_t * const *yscans = ff_vp9_scans[tx]; const int16_t (* const * ynbs)[2] = ff_vp9_scans_nb[tx]; @@ -1262,7 +1262,7 @@ void ff_vp9_decode_block(VP9TileData *td, int row, int col, VP9Filter *lflvl, ptrdiff_t yoff, ptrdiff_t uvoff, enum BlockLevel bl, enum BlockPartition bp) { - VP9Context *s = td->s; + const VP9Context *s = td->s; VP9Block *b = td->b; enum BlockSize bs = bl * 3 + bp; int bytesperpixel = s->bytesperpixel; diff --git a/libavcodec/vp9dec.h b/libavcodec/vp9dec.h index 9cbd5839a8..3621504fc8 100644 --- a/libavcodec/vp9dec.h +++ b/libavcodec/vp9dec.h @@ -163,9 +163,7 @@ typedef struct VP9Context { } VP9Context; struct VP9TileData { - //VP9Context should be const, but because of the threading API(generates - //a lot of warnings) it's not. - VP9Context *s; + const VP9Context *s; VP56RangeCoder *c_b; VP56RangeCoder *c; int row, row7, col, col7; diff --git a/libavcodec/vp9mvs.c b/libavcodec/vp9mvs.c index ddce9b6c84..16a2978035 100644 --- a/libavcodec/vp9mvs.c +++ b/libavcodec/vp9mvs.c @@ -65,7 +65,7 @@ static void find_ref_mvs(VP9TileData *td, [BS_4x4] = { { 0, -1 }, { -1, 0 }, { -1, -1 }, { 0, -2 }, { -2, 0 }, { -1, -2 }, { -2, -1 }, { -2, -2 } }, }; - VP9Context *s = td->s; + const VP9Context *s = td->s; VP9Block *b = td->b; int row = td->row, col = td->col, row7 = td->row7; 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) { - VP9Context *s = td->s; + const VP9Context *s = td->s; int bit, sign = vp56_rac_get_prob(td->c, s->prob.p.mv_comp[idx].sign); int n, c = vp8_rac_get_tree(td->c, ff_vp9_mv_class_tree, 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, VP56mv *mv, int mode, int sb) { - VP9Context *s = td->s; + const VP9Context *s = td->s; VP9Block *b = td->b; if (mode == ZEROMV) { diff --git a/libavcodec/vp9recon.c b/libavcodec/vp9recon.c index 1cdbc6a71d..da6249f82d 100644 --- a/libavcodec/vp9recon.c +++ b/libavcodec/vp9recon.c @@ -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 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_left = col > td->tile_col_start || x > 0; 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, ptrdiff_t uv_off, int bytesperpixel) { - VP9Context *s = td->s; + const VP9Context *s = td->s; VP9Block *b = td->b; int row = td->row, col = td->col; 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); } -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, const uint8_t *ref, ptrdiff_t ref_stride, const ThreadFrame *ref_frame, ptrdiff_t y, ptrdiff_t x, const VP56mv *mv, 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; 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); } -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, ptrdiff_t dst_stride, 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 VP56mv *mv, 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; y += my >> 4; @@ -404,7 +404,7 @@ static av_always_inline void mc_chroma_unscaled(VP9TileData *td, vp9_mc_func (*m #undef SCALED 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, const uint8_t *ref, ptrdiff_t ref_stride, 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, 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 && 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, @@ -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, - vp9_mc_func (*mc)[2], + const vp9_mc_func (*mc)[2], uint8_t *dst_u, uint8_t *dst_v, ptrdiff_t dst_stride, 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, 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 && 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, @@ -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) { - VP9Context *s = td->s; + const VP9Context *s = td->s; VP9Block *b = td->b; int row = td->row, col = td->col; -- 2.34.1 _______________________________________________ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org https://ffmpeg.org/mailman/listinfo/ffmpeg-devel To unsubscribe, visit link above, or email ffmpeg-devel-request@ffmpeg.org with subject "unsubscribe".
next prev parent reply other threads:[~2022-07-27 9:32 UTC|newest] Thread overview: 51+ messages / expand[flat|nested] mbox.gz Atom feed top 2022-07-26 21:47 [FFmpeg-devel] [PATCH 01/39] avcodec/hevcdsp: Constify src pointers Andreas Rheinhardt 2022-07-26 22:07 ` [FFmpeg-devel] [PATCH 02/39] avcodec/hevcdec: Constify src pointers of HEVC DSP functions Andreas Rheinhardt 2022-07-26 22:07 ` [FFmpeg-devel] [PATCH 03/39] avcodec/threadframe: Constify the frame in ff_thread_await_progress Andreas Rheinhardt 2022-07-26 22:07 ` [FFmpeg-devel] [PATCH 04/39] avcodec: Constify ThreadFrames if possible Andreas Rheinhardt 2022-07-26 22:07 ` Andreas Rheinhardt [this message] 2022-07-27 10:25 ` [FFmpeg-devel] [PATCH 05/39] avcodec/vp9dec: Constify VP9TileData->VP9Context pointer target Ronald S. Bultje 2022-07-26 22:07 ` [FFmpeg-devel] [PATCH 06/39] avcodec/wavpack: Constify slice threads' ptr to main context Andreas Rheinhardt 2022-07-26 22:07 ` [FFmpeg-devel] [PATCH 07/39] avcodec/vp8: " Andreas Rheinhardt 2022-07-27 10:24 ` Ronald S. Bultje 2022-07-26 22:07 ` [FFmpeg-devel] [PATCH 08/39] avcodec/proresdec2: " Andreas Rheinhardt 2022-07-26 22:07 ` [FFmpeg-devel] [PATCH 09/39] avcodec/magicyuv: " Andreas Rheinhardt 2022-07-26 22:07 ` [FFmpeg-devel] [PATCH 10/39] avcodec/jpeg2000dec: " Andreas Rheinhardt 2022-07-26 22:07 ` [FFmpeg-devel] [PATCH 11/39] avcodec/dxv: " Andreas Rheinhardt 2022-07-26 22:07 ` [FFmpeg-devel] [PATCH 12/39] avcodec/dvdec: " Andreas Rheinhardt 2022-07-26 22:07 ` [FFmpeg-devel] [PATCH 13/39] avcodec/diracdec: " Andreas Rheinhardt 2022-07-26 22:07 ` [FFmpeg-devel] [PATCH 14/39] avcodec/half2float: Constify arrays in half2float() Andreas Rheinhardt 2022-07-26 22:07 ` [FFmpeg-devel] [PATCH 15/39] avcodec/exr: Constify slice threads' ptr to main context Andreas Rheinhardt 2022-07-26 22:07 ` [FFmpeg-devel] [PATCH 16/39] avcodec/xwdenc: Don't modify input frame Andreas Rheinhardt 2022-07-26 22:07 ` [FFmpeg-devel] [PATCH 17/39] swscale/rgb2rgb: Don't cast const away Andreas Rheinhardt 2022-07-26 22:07 ` [FFmpeg-devel] [PATCH 18/39] avcodec/gif: Remove redundant cast Andreas Rheinhardt 2022-07-26 22:07 ` [FFmpeg-devel] [PATCH 19/39] avcodec/fitsenc: Don't cast const away unnecessarily Andreas Rheinhardt 2022-07-26 22:07 ` [FFmpeg-devel] [PATCH 20/39] avcodec/diracdsp: " Andreas Rheinhardt 2022-07-26 22:07 ` [FFmpeg-devel] [PATCH 21/39] avcodec/dxv: " Andreas Rheinhardt 2022-07-26 22:07 ` [FFmpeg-devel] [PATCH 22/39] avcodec/cinepakenc: Avoid casting const away Andreas Rheinhardt 2022-07-26 22:07 ` [FFmpeg-devel] [PATCH 23/39] avcodec/ilbcdec: Fix const correctness Andreas Rheinhardt 2022-07-26 22:07 ` [FFmpeg-devel] [PATCH 24/39] avcodec/ilbcdec: Move transient GetBitContext from ctx to stack Andreas Rheinhardt 2022-07-26 22:08 ` [FFmpeg-devel] [PATCH 25/39] avcodec/pnmdec, pnm_parser: Improve const-correctness Andreas Rheinhardt 2022-07-26 22:08 ` [FFmpeg-devel] [PATCH 26/39] avcodec/pnmdec: Fix indentation Andreas Rheinhardt 2022-07-26 22:08 ` [FFmpeg-devel] [PATCH 27/39] avcodec/videodsp: Constify buf in VideoDSPContext.prefetch Andreas Rheinhardt 2022-07-26 22:08 ` [FFmpeg-devel] [PATCH 28/39] avcodec/snow: Remove unused halfpel_plane Andreas Rheinhardt 2022-07-26 22:08 ` [FFmpeg-devel] [PATCH 29/39] avcodec/pngenc: Don't cast const away unnecessarily Andreas Rheinhardt 2022-07-26 22:08 ` [FFmpeg-devel] [PATCH 30/39] avcodec/lossless_videoencdsp: Constify src sub_left_predict Andreas Rheinhardt 2022-07-26 22:08 ` [FFmpeg-devel] [PATCH 31/39] avcodec/me_cmp: Constify me_cmp_func buffer parameters Andreas Rheinhardt 2022-07-26 22:08 ` [FFmpeg-devel] [PATCH 32/39] avcodec/h264chroma: Constify src in h264_chroma_mc_func Andreas Rheinhardt 2022-07-26 22:08 ` [FFmpeg-devel] [PATCH 33/39] avcodec/cfhdencdsp: Constify input pointers Andreas Rheinhardt 2022-07-26 22:08 ` [FFmpeg-devel] [PATCH 34/39] avcodec/mpegvideoencdsp: Allow pointers to const where possible Andreas Rheinhardt 2022-07-28 22:05 ` Michael Niedermayer 2022-07-30 9:55 ` Andreas Rheinhardt 2022-07-30 17:12 ` Michael Niedermayer 2022-08-02 9:30 ` Anton Khirnov 2022-08-03 15:28 ` Michael Niedermayer 2022-08-03 15:48 ` Michael Niedermayer 2022-08-06 13:07 ` Anton Khirnov 2022-07-26 22:08 ` [FFmpeg-devel] [PATCH 35/39] avcodec/mpegvideodsp: Constify src pointers Andreas Rheinhardt 2022-07-26 22:08 ` [FFmpeg-devel] [PATCH 36/39] avcodec/motion_est: Constify pointers to frame data Andreas Rheinhardt 2022-07-28 22:04 ` Michael Niedermayer 2022-07-26 22:08 ` [FFmpeg-devel] [PATCH 37/39] avcodec/mpegvideo_motion: Constify ff_mpv_motion Andreas Rheinhardt 2022-07-28 22:03 ` Michael Niedermayer 2022-07-26 22:08 ` [FFmpeg-devel] [PATCH 38/39] avcodec: Constify frame->data pointers for encoders where possible Andreas Rheinhardt 2022-07-26 22:08 ` [FFmpeg-devel] [PATCH 39/39] avcodec/mpegvideo: Inline values in ff_update_block_index() Andreas Rheinhardt 2022-07-28 22:02 ` Michael Niedermayer
Reply instructions: You may reply publicly to this message via plain-text email using any one of the following methods: * Save the following mbox file, import it into your mail client, and reply-to-all from there: mbox Avoid top-posting and favor interleaved quoting: https://en.wikipedia.org/wiki/Posting_style#Interleaved_style * Reply using the --to, --cc, and --in-reply-to switches of git-send-email(1): git send-email \ --in-reply-to=DB6PR0101MB22143F825F1E13EEAC85E32D8F949@DB6PR0101MB2214.eurprd01.prod.exchangelabs.com \ --to=andreas.rheinhardt@outlook.com \ --cc=ffmpeg-devel@ffmpeg.org \ /path/to/YOUR_REPLY https://kernel.org/pub/software/scm/git/docs/git-send-email.html * If your mail client supports setting the In-Reply-To header via mailto: links, try the mailto: link
Git Inbox Mirror of the ffmpeg-devel mailing list - see https://ffmpeg.org/mailman/listinfo/ffmpeg-devel This inbox may be cloned and mirrored by anyone: git clone --mirror https://master.gitmailbox.com/ffmpegdev/0 ffmpegdev/git/0.git # If you have public-inbox 1.1+ installed, you may # initialize and index your mirror using the following commands: public-inbox-init -V2 ffmpegdev ffmpegdev/ https://master.gitmailbox.com/ffmpegdev \ ffmpegdev@gitmailbox.com public-inbox-index ffmpegdev Example config snippet for mirrors. AGPL code for this site: git clone https://public-inbox.org/public-inbox.git