[FFmpeg-devel] [PATCH 1/4] avcodec/jpeg2000dec, j2kenc: Constify where appropriate

Andreas Rheinhardt andreas.rheinhardt at outlook.com
Mon Feb 19 13:30:48 EET 2024


Andreas Rheinhardt:
> Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt at outlook.com>
> ---
>  libavcodec/j2kenc.c      |  2 +-
>  libavcodec/jpeg2000dec.c | 14 +++++++-------
>  2 files changed, 8 insertions(+), 8 deletions(-)
> 
> diff --git a/libavcodec/j2kenc.c b/libavcodec/j2kenc.c
> index 789791f529..ebf21f6e7a 100644
> --- a/libavcodec/j2kenc.c
> +++ b/libavcodec/j2kenc.c
> @@ -781,7 +781,7 @@ static void putnumpasses(Jpeg2000EncoderContext *s, int n)
>  
>  
>  static int encode_packet(Jpeg2000EncoderContext *s, Jpeg2000ResLevel *rlevel, int layno,
> -                         int precno, uint8_t *expn, int numgbits, int packetno,
> +                         int precno, const uint8_t *expn, int numgbits, int packetno,
>                           int nlayers)
>  {
>      int bandno, empty = 1;
> diff --git a/libavcodec/jpeg2000dec.c b/libavcodec/jpeg2000dec.c
> index 691cfbd891..3d18d48e7c 100644
> --- a/libavcodec/jpeg2000dec.c
> +++ b/libavcodec/jpeg2000dec.c
> @@ -489,7 +489,7 @@ static int get_cox(Jpeg2000DecoderContext *s, Jpeg2000CodingStyle *c)
>  
>  /* get coding parameters for a particular tile or whole image*/
>  static int get_cod(Jpeg2000DecoderContext *s, Jpeg2000CodingStyle *c,
> -                   uint8_t *properties)
> +                   const uint8_t *properties)
>  {
>      Jpeg2000CodingStyle tmp;
>      int compno, ret;
> @@ -639,7 +639,7 @@ static int get_qcx(Jpeg2000DecoderContext *s, int n, Jpeg2000QuantStyle *q)
>  
>  /* Get quantization parameters for a particular tile or a whole image. */
>  static int get_qcd(Jpeg2000DecoderContext *s, int n, Jpeg2000QuantStyle *q,
> -                   uint8_t *properties)
> +                   const uint8_t *properties)
>  {
>      Jpeg2000QuantStyle tmp;
>      int compno, ret;
> @@ -1004,7 +1004,7 @@ static int getlblockinc(Jpeg2000DecoderContext *s)
>      return res;
>  }
>  
> -static inline void select_header(Jpeg2000DecoderContext *s, Jpeg2000Tile *tile,
> +static inline void select_header(Jpeg2000DecoderContext *s, const Jpeg2000Tile *tile,
>                                   int *tp_index)
>  {
>      s->g = tile->tile_part[*tp_index].header_tpg;
> @@ -1015,8 +1015,8 @@ static inline void select_header(Jpeg2000DecoderContext *s, Jpeg2000Tile *tile,
>      }
>  }
>  
> -static inline void select_stream(Jpeg2000DecoderContext *s, Jpeg2000Tile *tile,
> -                                 int *tp_index, Jpeg2000CodingStyle *codsty)
> +static inline void select_stream(Jpeg2000DecoderContext *s, const Jpeg2000Tile *tile,
> +                                 int *tp_index, const Jpeg2000CodingStyle *codsty)
>  {
>      s->g = tile->tile_part[*tp_index].tpg;
>      if (bytestream2_get_bytes_left(&s->g) == 0 && s->bit_index == 8) {
> @@ -1033,9 +1033,9 @@ static inline void select_stream(Jpeg2000DecoderContext *s, Jpeg2000Tile *tile,
>  }
>  
>  static int jpeg2000_decode_packet(Jpeg2000DecoderContext *s, Jpeg2000Tile *tile, int *tp_index,
> -                                  Jpeg2000CodingStyle *codsty,
> +                                  const Jpeg2000CodingStyle *codsty,
>                                    Jpeg2000ResLevel *rlevel, int precno,
> -                                  int layno, uint8_t *expn, int numgbits)
> +                                  int layno, const uint8_t *expn, int numgbits)
>  {
>      int bandno, cblkno, ret, nb_code_blocks;
>      int cwsno;

Will apply this patchset tomorrow unless there are objections.

- Andreas



More information about the ffmpeg-devel mailing list