diff options
author | Andreas Rheinhardt <andreas.rheinhardt@outlook.com> | 2022-07-26 09:09:44 +0200 |
---|---|---|
committer | Andreas Rheinhardt <andreas.rheinhardt@outlook.com> | 2022-08-05 03:21:41 +0200 |
commit | 5828e8209f48f206c42b69e314a6988b50e98924 (patch) | |
tree | b1ce7a4fdbafb8e2ec3706340736812dae042016 /libavcodec/pngenc.c | |
parent | cee40a945abc3568e270899eefb8bf6cf7e5ab3c (diff) | |
download | ffmpeg-5828e8209f48f206c42b69e314a6988b50e98924.tar.gz |
avcodec: Constify frame->data pointers for encoders where possible
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
Diffstat (limited to 'libavcodec/pngenc.c')
-rw-r--r-- | libavcodec/pngenc.c | 18 |
1 files changed, 9 insertions, 9 deletions
diff --git a/libavcodec/pngenc.c b/libavcodec/pngenc.c index c86cf5a862..ca9873f673 100644 --- a/libavcodec/pngenc.c +++ b/libavcodec/pngenc.c @@ -120,7 +120,7 @@ static void png_get_interlaced_row(uint8_t *dst, int row_size, } } -static void sub_png_paeth_prediction(uint8_t *dst, uint8_t *src, uint8_t *top, +static void sub_png_paeth_prediction(uint8_t *dst, const uint8_t *src, const uint8_t *top, int w, int bpp) { int i; @@ -165,7 +165,7 @@ static void sub_left_prediction(PNGEncContext *c, uint8_t *dst, const uint8_t *s } static void png_filter_row(PNGEncContext *c, uint8_t *dst, int filter_type, - uint8_t *src, uint8_t *top, int size, int bpp) + const uint8_t *src, const uint8_t *top, int size, int bpp) { int i; @@ -194,7 +194,7 @@ static void png_filter_row(PNGEncContext *c, uint8_t *dst, int filter_type, } static uint8_t *png_choose_filter(PNGEncContext *s, uint8_t *dst, - uint8_t *src, uint8_t *top, int size, int bpp) + const uint8_t *src, const uint8_t *top, int size, int bpp) { int pred = s->filter_type; av_assert0(bpp || !pred); @@ -486,7 +486,7 @@ static int encode_frame(AVCodecContext *avctx, const AVFrame *pict) const AVFrame *const p = pict; int y, len, ret; int row_size, pass_row_size; - uint8_t *ptr, *top, *crow_buf, *crow; + uint8_t *crow_buf, *crow; uint8_t *crow_base = NULL; uint8_t *progressive_buf = NULL; uint8_t *top_buf = NULL; @@ -520,10 +520,10 @@ static int encode_frame(AVCodecContext *avctx, const AVFrame *pict) * output */ pass_row_size = ff_png_pass_row_size(pass, s->bits_per_pixel, pict->width); if (pass_row_size > 0) { - top = NULL; + uint8_t *top = NULL; for (y = 0; y < pict->height; y++) if ((ff_png_pass_ymask[pass] << (y & 7)) & 0x80) { - ptr = p->data[0] + y * p->linesize[0]; + const uint8_t *ptr = p->data[0] + y * p->linesize[0]; FFSWAP(uint8_t *, progressive_buf, top_buf); png_get_interlaced_row(progressive_buf, pass_row_size, s->bits_per_pixel, pass, @@ -536,9 +536,9 @@ static int encode_frame(AVCodecContext *avctx, const AVFrame *pict) } } } else { - top = NULL; + const uint8_t *top = NULL; for (y = 0; y < pict->height; y++) { - ptr = p->data[0] + y * p->linesize[0]; + const uint8_t *ptr = p->data[0] + y * p->linesize[0]; crow = png_choose_filter(s, crow_buf, ptr, top, row_size, s->bits_per_pixel >> 3); png_write_row(avctx, crow, row_size + 1); @@ -723,7 +723,7 @@ static int apng_do_inverse_blend(AVFrame *output, const AVFrame *input, } for (y = topmost_y; y < bottommost_y; ++y) { - uint8_t *foreground = input->data[0] + input_linesize * y + bpp * leftmost_x; + const uint8_t *foreground = input->data[0] + input_linesize * y + bpp * leftmost_x; uint8_t *background = output->data[0] + output_linesize * y + bpp * leftmost_x; output_data = output->data[0] + output_linesize * (y - topmost_y); for (x = leftmost_x; x < rightmost_x; ++x, foreground += bpp, background += bpp, output_data += bpp) { |