Git Inbox Mirror of the ffmpeg-devel mailing list - see https://ffmpeg.org/mailman/listinfo/ffmpeg-devel
 help / color / mirror / Atom feed
From: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
To: ffmpeg-devel@ffmpeg.org
Cc: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
Subject: [FFmpeg-devel] [PATCH 04/39] avcodec: Constify ThreadFrames if possible
Date: Wed, 27 Jul 2022 00:07:39 +0200
Message-ID: <DB6PR0101MB2214E402720DE1C76177CEF98F949@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/h264_slice.c      | 2 +-
 libavcodec/hevc_mvs.c        | 2 +-
 libavcodec/hevcdec.c         | 4 ++--
 libavcodec/rv34.c            | 2 +-
 libavcodec/vp3.c             | 2 +-
 libavcodec/vp8.c             | 9 +++++----
 libavcodec/vp9_mc_template.c | 4 ++--
 libavcodec/vp9recon.c        | 8 ++++----
 8 files changed, 17 insertions(+), 16 deletions(-)

diff --git a/libavcodec/h264_slice.c b/libavcodec/h264_slice.c
index d56722a5c2..8f9d0a6231 100644
--- a/libavcodec/h264_slice.c
+++ b/libavcodec/h264_slice.c
@@ -1649,7 +1649,7 @@ static int h264_field_start(H264Context *h, const H264SliceContext *sl,
 
     while (h->poc.frame_num != h->poc.prev_frame_num && !h->first_field &&
            h->poc.frame_num != (h->poc.prev_frame_num + 1) % (1 << sps->log2_max_frame_num)) {
-        H264Picture *prev = h->short_ref_count ? h->short_ref[0] : NULL;
+        const H264Picture *prev = h->short_ref_count ? h->short_ref[0] : NULL;
         av_log(h->avctx, AV_LOG_DEBUG, "Frame num gap %d %d\n",
                h->poc.frame_num, h->poc.prev_frame_num);
         if (!sps->gaps_in_frame_num_allowed_flag)
diff --git a/libavcodec/hevc_mvs.c b/libavcodec/hevc_mvs.c
index bcf6ec3abc..c231797a57 100644
--- a/libavcodec/hevc_mvs.c
+++ b/libavcodec/hevc_mvs.c
@@ -227,7 +227,7 @@ static int temporal_luma_motion_vector(const HEVCContext *s, int x0, int y0,
     int availableFlagLXCol = 0;
     int colPic;
 
-    HEVCFrame *ref = s->ref->collocated_ref;
+    const HEVCFrame *ref = s->ref->collocated_ref;
 
     if (!ref) {
         memset(mvLXCol, 0, sizeof(*mvLXCol));
diff --git a/libavcodec/hevcdec.c b/libavcodec/hevcdec.c
index ea196b39a9..24da690e94 100644
--- a/libavcodec/hevcdec.c
+++ b/libavcodec/hevcdec.c
@@ -1808,7 +1808,7 @@ static void chroma_mc_bi(HEVCLocalContext *lc, uint8_t *dst0, ptrdiff_t dststrid
                                                          _mx1, _my1, block_w);
 }
 
-static void hevc_await_progress(const HEVCContext *s, HEVCFrame *ref,
+static void hevc_await_progress(const HEVCContext *s, const HEVCFrame *ref,
                                 const Mv *mv, int y0, int height)
 {
     if (s->threads_type == FF_THREAD_FRAME ) {
@@ -1878,7 +1878,7 @@ static void hls_prediction_unit(HEVCLocalContext *lc, int x0, int y0,
 
     MvField *tab_mvf = s->ref->tab_mvf;
     const RefPicList *refPicList = s->ref->refPicList;
-    HEVCFrame *ref0 = NULL, *ref1 = NULL;
+    const HEVCFrame *ref0 = NULL, *ref1 = NULL;
     uint8_t *dst0 = POS(0, x0, y0);
     uint8_t *dst1 = POS(1, x0, y0);
     uint8_t *dst2 = POS(2, x0, y0);
diff --git a/libavcodec/rv34.c b/libavcodec/rv34.c
index 5f3b7d31cd..2ac3f2c7b2 100644
--- a/libavcodec/rv34.c
+++ b/libavcodec/rv34.c
@@ -703,7 +703,7 @@ static inline void rv34_mc(RV34DecContext *r, const int block_type,
     if (HAVE_THREADS && (s->avctx->active_thread_type & FF_THREAD_FRAME)) {
         /* wait for the referenced mb row to be finished */
         int mb_row = s->mb_y + ((yoff + my + 5 + 8 * height) >> 4);
-        ThreadFrame *f = dir ? &s->next_picture_ptr->tf : &s->last_picture_ptr->tf;
+        const ThreadFrame *f = dir ? &s->next_picture_ptr->tf : &s->last_picture_ptr->tf;
         ff_thread_await_progress(f, mb_row, 0);
     }
 
diff --git a/libavcodec/vp3.c b/libavcodec/vp3.c
index 53fc514788..3f6b0100d9 100644
--- a/libavcodec/vp3.c
+++ b/libavcodec/vp3.c
@@ -1950,7 +1950,7 @@ static void vp3_draw_horiz_band(Vp3DecodeContext *s, int y)
 static void await_reference_row(Vp3DecodeContext *s, Vp3Fragment *fragment,
                                 int motion_y, int y)
 {
-    ThreadFrame *ref_frame;
+    const ThreadFrame *ref_frame;
     int ref_row;
     int border = motion_y & 1;
 
diff --git a/libavcodec/vp8.c b/libavcodec/vp8.c
index 10de962118..e474fc5de5 100644
--- a/libavcodec/vp8.c
+++ b/libavcodec/vp8.c
@@ -1247,7 +1247,7 @@ void decode_intra4x4_modes(VP8Context *s, VP56RangeCoder *c, VP8Macroblock *mb,
 static av_always_inline
 void decode_mb_mode(VP8Context *s, VP8mvbounds *mv_bounds,
                     VP8Macroblock *mb, int mb_x, int mb_y,
-                    uint8_t *segment, uint8_t *ref, int layout, int is_vp7)
+                    uint8_t *segment, const uint8_t *ref, int layout, int is_vp7)
 {
     VP56RangeCoder *c = &s->c;
     static const char * const vp7_feature_name[] = { "q-index",
@@ -1811,7 +1811,7 @@ static const uint8_t subpel_idx[3][8] = {
  */
 static av_always_inline
 void vp8_mc_luma(VP8Context *s, VP8ThreadData *td, uint8_t *dst,
-                 ThreadFrame *ref, const VP56mv *mv,
+                 const ThreadFrame *ref, const VP56mv *mv,
                  int x_off, int y_off, int block_w, int block_h,
                  int width, int height, ptrdiff_t linesize,
                  vp8_mc_func mc_func[3][3])
@@ -1869,7 +1869,7 @@ void vp8_mc_luma(VP8Context *s, VP8ThreadData *td, uint8_t *dst,
  */
 static av_always_inline
 void vp8_mc_chroma(VP8Context *s, VP8ThreadData *td, uint8_t *dst1,
-                   uint8_t *dst2, ThreadFrame *ref, const VP56mv *mv,
+                   uint8_t *dst2, const ThreadFrame *ref, const VP56mv *mv,
                    int x_off, int y_off, int block_w, int block_h,
                    int width, int height, ptrdiff_t linesize,
                    vp8_mc_func mc_func[3][3])
@@ -2374,7 +2374,8 @@ static av_always_inline int decode_mb_row_no_filter(AVCodecContext *avctx, void
     int mb_y = atomic_load(&td->thread_mb_pos) >> 16;
     int mb_x, mb_xy = mb_y * s->mb_width;
     int num_jobs = s->num_jobs;
-    VP8Frame *curframe = s->curframe, *prev_frame = s->prev_frame;
+    const VP8Frame *prev_frame = s->prev_frame;
+    VP8Frame *curframe = s->curframe;
     VP56RangeCoder *c  = &s->coeff_partition[mb_y & (s->num_coeff_partitions - 1)];
     VP8Macroblock *mb;
     uint8_t *dst[3] = {
diff --git a/libavcodec/vp9_mc_template.c b/libavcodec/vp9_mc_template.c
index 31e692f362..d0c12e81f1 100644
--- a/libavcodec/vp9_mc_template.c
+++ b/libavcodec/vp9_mc_template.c
@@ -36,8 +36,8 @@ static void FN(inter_pred)(VP9TileData *td)
     VP9Context *s = td->s;
     VP9Block *b = td->b;
     int row = td->row, col = td->col;
-    ThreadFrame *tref1 = &s->s.refs[s->s.h.refidx[b->ref[0]]], *tref2;
-    AVFrame *ref1 = tref1->f, *ref2;
+    const ThreadFrame *tref1 = &s->s.refs[s->s.h.refidx[b->ref[0]]], *tref2;
+    const AVFrame *ref1 = tref1->f, *ref2;
     int w1 = ref1->width, h1 = ref1->height, w2, h2;
     ptrdiff_t ls_y = td->y_stride, ls_uv = td->uv_stride;
     int bytesperpixel = BYTES_PER_PIXEL;
diff --git a/libavcodec/vp9recon.c b/libavcodec/vp9recon.c
index bfafde8c9c..1cdbc6a71d 100644
--- a/libavcodec/vp9recon.c
+++ b/libavcodec/vp9recon.c
@@ -298,7 +298,7 @@ void ff_vp9_intra_recon_16bpp(VP9TileData *td, ptrdiff_t y_off, ptrdiff_t uv_off
 static av_always_inline void mc_luma_unscaled(VP9TileData *td, vp9_mc_func (*mc)[2],
                                               uint8_t *dst, ptrdiff_t dst_stride,
                                               const uint8_t *ref, ptrdiff_t ref_stride,
-                                              ThreadFrame *ref_frame,
+                                              const ThreadFrame *ref_frame,
                                               ptrdiff_t y, ptrdiff_t x, const VP56mv *mv,
                                               int bw, int bh, int w, int h, int bytesperpixel)
 {
@@ -336,7 +336,7 @@ static av_always_inline void mc_chroma_unscaled(VP9TileData *td, vp9_mc_func (*m
                                                 ptrdiff_t dst_stride,
                                                 const uint8_t *ref_u, ptrdiff_t src_stride_u,
                                                 const uint8_t *ref_v, ptrdiff_t src_stride_v,
-                                                ThreadFrame *ref_frame,
+                                                const ThreadFrame *ref_frame,
                                                 ptrdiff_t y, ptrdiff_t x, const VP56mv *mv,
                                                 int bw, int bh, int w, int h, int bytesperpixel)
 {
@@ -407,7 +407,7 @@ static av_always_inline void mc_luma_scaled(VP9TileData *td, vp9_scaled_mc_func
                                             vp9_mc_func (*mc)[2],
                                             uint8_t *dst, ptrdiff_t dst_stride,
                                             const uint8_t *ref, ptrdiff_t ref_stride,
-                                            ThreadFrame *ref_frame,
+                                            const ThreadFrame *ref_frame,
                                             ptrdiff_t y, ptrdiff_t x, const VP56mv *in_mv,
                                             int px, int py, int pw, int ph,
                                             int bw, int bh, int w, int h, int bytesperpixel,
@@ -467,7 +467,7 @@ static av_always_inline void mc_chroma_scaled(VP9TileData *td, vp9_scaled_mc_fun
                                               ptrdiff_t dst_stride,
                                               const uint8_t *ref_u, ptrdiff_t src_stride_u,
                                               const uint8_t *ref_v, ptrdiff_t src_stride_v,
-                                              ThreadFrame *ref_frame,
+                                              const ThreadFrame *ref_frame,
                                               ptrdiff_t y, ptrdiff_t x, const VP56mv *in_mv,
                                               int px, int py, int pw, int ph,
                                               int bw, int bh, int w, int h, int bytesperpixel,
-- 
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".

  parent reply	other threads:[~2022-07-27  9:30 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 ` Andreas Rheinhardt [this message]
2022-07-26 22:07 ` [FFmpeg-devel] [PATCH 05/39] avcodec/vp9dec: Constify VP9TileData->VP9Context pointer target Andreas Rheinhardt
2022-07-27 10:25   ` 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=DB6PR0101MB2214E402720DE1C76177CEF98F949@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