diff options
author | Andreas Rheinhardt <andreas.rheinhardt@outlook.com> | 2023-09-07 00:09:10 +0200 |
---|---|---|
committer | Andreas Rheinhardt <andreas.rheinhardt@outlook.com> | 2023-09-12 09:42:27 +0200 |
commit | 423b6a7e493828dd91d5e590e0905236f1f46557 (patch) | |
tree | 2bdbe0020ba7ecab45e3f0909a7f3d862520a6c7 /libavfilter/vf_framepack.c | |
parent | 5094d1f429e58a67c542f1c5940a3de5184c35ca (diff) | |
download | ffmpeg-423b6a7e493828dd91d5e590e0905236f1f46557.tar.gz |
avutil/imgutils: Add wrapper for av_image_copy() to avoid casts
av_image_copy() accepts const uint8_t* const * as source;
lots of user have uint8_t* const * and therefore either
cast (the majority) or copy the array of pointers.
This commit changes this by adding a static inline wrapper
for av_image_copy() that casts between the two types
so that we do not need to add casts everywhere else.
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
Diffstat (limited to 'libavfilter/vf_framepack.c')
-rw-r--r-- | libavfilter/vf_framepack.c | 28 |
1 files changed, 10 insertions, 18 deletions
diff --git a/libavfilter/vf_framepack.c b/libavfilter/vf_framepack.c index 8693ad6488..cbfcf1e036 100644 --- a/libavfilter/vf_framepack.c +++ b/libavfilter/vf_framepack.c @@ -234,22 +234,18 @@ static void horizontal_frame_pack(AVFilterLink *outlink, } else { for (i = 0; i < 2; i++) { const int psize = 1 + (s->depth > 8); - const uint8_t *src[4]; uint8_t *dst[4]; int sub_w = psize * s->input_views[i]->width >> s->pix_desc->log2_chroma_w; - src[0] = s->input_views[i]->data[0]; - src[1] = s->input_views[i]->data[1]; - src[2] = s->input_views[i]->data[2]; - dst[0] = out->data[0] + i * s->input_views[i]->width * psize; dst[1] = out->data[1] + i * sub_w; dst[2] = out->data[2] + i * sub_w; - av_image_copy(dst, out->linesize, src, s->input_views[i]->linesize, - s->input_views[i]->format, - s->input_views[i]->width, - s->input_views[i]->height); + av_image_copy2(dst, out->linesize, + s->input_views[i]->data, s->input_views[i]->linesize, + s->input_views[i]->format, + s->input_views[i]->width, + s->input_views[i]->height); } } } @@ -263,15 +259,10 @@ static void vertical_frame_pack(AVFilterLink *outlink, int i; for (i = 0; i < 2; i++) { - const uint8_t *src[4]; uint8_t *dst[4]; int linesizes[4]; int sub_h = s->input_views[i]->height >> s->pix_desc->log2_chroma_h; - src[0] = s->input_views[i]->data[0]; - src[1] = s->input_views[i]->data[1]; - src[2] = s->input_views[i]->data[2]; - dst[0] = out->data[0] + i * out->linesize[0] * (interleaved + s->input_views[i]->height * (1 - interleaved)); dst[1] = out->data[1] + i * out->linesize[1] * @@ -286,10 +277,11 @@ static void vertical_frame_pack(AVFilterLink *outlink, linesizes[2] = out->linesize[2] + interleaved * out->linesize[2]; - av_image_copy(dst, linesizes, src, s->input_views[i]->linesize, - s->input_views[i]->format, - s->input_views[i]->width, - s->input_views[i]->height); + av_image_copy2(dst, linesizes, + s->input_views[i]->data, s->input_views[i]->linesize, + s->input_views[i]->format, + s->input_views[i]->width, + s->input_views[i]->height); } } |