Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/FFmpeg/FFmpeg.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAndreas Rheinhardt <andreas.rheinhardt@outlook.com>2022-02-22 23:29:17 +0300
committerAndreas Rheinhardt <andreas.rheinhardt@outlook.com>2022-02-23 13:51:41 +0300
commitf57e522ce2098e633024204c6f0cfad0185e1a2c (patch)
treeebb3f8fcd59d77eb32bcdba8b1b9a24faf71a5d9 /libavcodec/magicyuvenc.c
parent047a4e580ecbe4542a9ad090af630d4e045df21e (diff)
avcodec/magicyuvenc: Avoid unnecessary av_frame_clone()
It is unnecessary and unchecked; the intention seems to be to ensure that the frame's data is writable, but it does not provide this. This will be fixed in a latter commit. Reviewed-by: Paul B Mahol <onemda@gmail.com> Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
Diffstat (limited to 'libavcodec/magicyuvenc.c')
-rw-r--r--libavcodec/magicyuvenc.c26
1 files changed, 12 insertions, 14 deletions
diff --git a/libavcodec/magicyuvenc.c b/libavcodec/magicyuvenc.c
index ab32d4cee3..4440ab3ce2 100644
--- a/libavcodec/magicyuvenc.c
+++ b/libavcodec/magicyuvenc.c
@@ -452,32 +452,30 @@ static int magy_encode_frame(AVCodecContext *avctx, AVPacket *pkt,
}
if (s->correlate) {
+ uint8_t *const data[4] = { frame->data[1], frame->data[0],
+ frame->data[2], frame->data[3] };
+ const int linesize[4] = { frame->linesize[1], frame->linesize[0],
+ frame->linesize[2], frame->linesize[3] };
uint8_t *r, *g, *b;
- AVFrame *p = av_frame_clone(frame);
- g = p->data[0];
- b = p->data[1];
- r = p->data[2];
+ g = frame->data[0];
+ b = frame->data[1];
+ r = frame->data[2];
for (i = 0; i < height; i++) {
s->llvidencdsp.diff_bytes(b, b, g, width);
s->llvidencdsp.diff_bytes(r, r, g, width);
- g += p->linesize[0];
- b += p->linesize[1];
- r += p->linesize[2];
+ g += frame->linesize[0];
+ b += frame->linesize[1];
+ r += frame->linesize[2];
}
- FFSWAP(uint8_t*, p->data[0], p->data[1]);
- FFSWAP(int, p->linesize[0], p->linesize[1]);
-
for (i = 0; i < s->planes; i++) {
for (slice = 0; slice < s->nb_slices; slice++) {
- s->predict(s, p->data[i], s->slices[i], p->linesize[i],
- p->width, p->height);
+ s->predict(s, data[i], s->slices[i], linesize[i],
+ frame->width, frame->height);
}
}
-
- av_frame_free(&p);
} else {
for (i = 0; i < s->planes; i++) {
for (slice = 0; slice < s->nb_slices; slice++) {