summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAndreas Rheinhardt <andreas.rheinhardt@outlook.com>2022-07-22 07:11:47 +0200
committerAndreas Rheinhardt <andreas.rheinhardt@outlook.com>2022-07-31 04:15:28 +0200
commit0eb399ac3953da16f880a1e455bb009a45f76d49 (patch)
tree453830435a3b5b58f4a358bf6f8c77131e3e65bf
parent34276b815b7eddffdd0713569e4b8009c923b029 (diff)
avcodec: Constify ThreadFrames if possible
This is possible now that ff_thread_await_progress() accepts a const ThreadFrame*. Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
-rw-r--r--libavcodec/h264_slice.c2
-rw-r--r--libavcodec/hevc_mvs.c2
-rw-r--r--libavcodec/hevcdec.c4
-rw-r--r--libavcodec/rv34.c2
-rw-r--r--libavcodec/vp3.c2
-rw-r--r--libavcodec/vp8.c9
-rw-r--r--libavcodec/vp9_mc_template.c4
-rw-r--r--libavcodec/vp9recon.c8
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 dbc77ade2a..9b14fa50f9 100644
--- a/libavcodec/hevcdec.c
+++ b/libavcodec/hevcdec.c
@@ -1799,7 +1799,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 ) {
@@ -1869,7 +1869,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 b789db05fd..61d1e4c527 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 06752e8c37..2687aeb1f8 100644
--- a/libavcodec/vp8.c
+++ b/libavcodec/vp8.c
@@ -1283,7 +1283,7 @@ void decode_intra4x4_modes(VP8Context *s, VPXRangeCoder *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)
{
VPXRangeCoder *c = &s->c;
static const char * const vp7_feature_name[] = { "q-index",
@@ -1848,7 +1848,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 VP8mv *mv,
+ const ThreadFrame *ref, const VP8mv *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])
@@ -1906,7 +1906,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 VP8mv *mv,
+ uint8_t *dst2, const ThreadFrame *ref, const VP8mv *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])
@@ -2411,7 +2411,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;
VPXRangeCoder *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 6ea3cc3225..0340c9f48a 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 e758dca55b..af53ffd1da 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 VP9mv *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 VP9mv *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 VP9mv *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 VP9mv *in_mv,
int px, int py, int pw, int ph,
int bw, int bh, int w, int h, int bytesperpixel,