diff mbox series

[FFmpeg-devel,12/39] avcodec/dvdec: Constify slice threads' ptr to main context

Message ID DB6PR0101MB22143D7097F440C84995B2668F949@DB6PR0101MB2214.eurprd01.prod.exchangelabs.com
State Accepted
Commit 597dc96736a960ed95f2cbbf0b32ddad210c7f2a
Headers show
Series [FFmpeg-devel,01/39] avcodec/hevcdsp: Constify src pointers | expand

Checks

Context Check Description
yinshiyou/make_loongarch64 fail Make failed
andriy/make_x86 success Make finished
andriy/make_fate_x86 success Make fate finished

Commit Message

Andreas Rheinhardt July 26, 2022, 10:07 p.m. UTC
Modifying the main context from a slice thread is (usually)
a data race, so it must not happen. So only use a pointer to const
to access the main context.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
---
 libavcodec/dv.h    | 4 ++--
 libavcodec/dvdec.c | 6 +++---
 2 files changed, 5 insertions(+), 5 deletions(-)
diff mbox series

Patch

diff --git a/libavcodec/dv.h b/libavcodec/dv.h
index 855afcc758..331b8e846a 100644
--- a/libavcodec/dv.h
+++ b/libavcodec/dv.h
@@ -109,8 +109,8 @@  static inline int dv_work_pool_size(const AVDVProfile *d)
     return size;
 }
 
-static inline void dv_calculate_mb_xy(DVVideoContext *s,
-                                      DVwork_chunk *work_chunk,
+static inline void dv_calculate_mb_xy(const DVVideoContext *s,
+                                      const DVwork_chunk *work_chunk,
                                       int m, int *mb_x, int *mb_y)
 {
     *mb_x = work_chunk->mb_coordinates[m] & 0xff;
diff --git a/libavcodec/dvdec.c b/libavcodec/dvdec.c
index 4760618a97..f7423580aa 100644
--- a/libavcodec/dvdec.c
+++ b/libavcodec/dvdec.c
@@ -345,7 +345,7 @@  static av_always_inline void put_block_8x4(int16_t *block, uint8_t *av_restrict
     }
 }
 
-static void dv100_idct_put_last_row_field_chroma(DVVideoContext *s, uint8_t *data,
+static void dv100_idct_put_last_row_field_chroma(const DVVideoContext *s, uint8_t *data,
                                                  int stride, int16_t *blocks)
 {
     s->idsp.idct(blocks + 0*64);
@@ -357,7 +357,7 @@  static void dv100_idct_put_last_row_field_chroma(DVVideoContext *s, uint8_t *dat
     put_block_8x4(blocks+1*64 + 4*8, data + 8 + stride, stride<<1);
 }
 
-static void dv100_idct_put_last_row_field_luma(DVVideoContext *s, uint8_t *data,
+static void dv100_idct_put_last_row_field_luma(const DVVideoContext *s, uint8_t *data,
                                                int stride, int16_t *blocks)
 {
     s->idsp.idct(blocks + 0*64);
@@ -378,7 +378,7 @@  static void dv100_idct_put_last_row_field_luma(DVVideoContext *s, uint8_t *data,
 /* mb_x and mb_y are in units of 8 pixels */
 static int dv_decode_video_segment(AVCodecContext *avctx, void *arg)
 {
-    DVVideoContext *s = avctx->priv_data;
+    const DVVideoContext *s = avctx->priv_data;
     DVwork_chunk *work_chunk = arg;
     int quant, dc, dct_mode, class1, j;
     int mb_index, mb_x, mb_y, last_index;