aboutsummaryrefslogtreecommitdiffstats
path: root/libavcodec/dfa.c
diff options
context:
space:
mode:
authorJames Almer <jamrial@gmail.com>2022-03-17 23:07:39 -0300
committerJames Almer <jamrial@gmail.com>2022-04-02 00:24:44 -0300
commit5021b2ba0653cc97165f40b2cf247cbf5122aae0 (patch)
tree3edcc5decfbc58934e2b071d8b9ffd30bb1f6a50 /libavcodec/dfa.c
parent2b2380c098569af88e7a77aff78f330d11090512 (diff)
downloadffmpeg-5021b2ba0653cc97165f40b2cf247cbf5122aae0.tar.gz
avcodec/dfa: don't check for the bitstream version on every copied line
And use av_image_copy_plane() while at it to simplify things for version != 0x100. Signed-off-by: James Almer <jamrial@gmail.com>
Diffstat (limited to 'libavcodec/dfa.c')
-rw-r--r--libavcodec/dfa.c14
1 files changed, 7 insertions, 7 deletions
diff --git a/libavcodec/dfa.c b/libavcodec/dfa.c
index 97a9bd5a1f..eaa1e7e33d 100644
--- a/libavcodec/dfa.c
+++ b/libavcodec/dfa.c
@@ -386,8 +386,8 @@ static int dfa_decode_frame(AVCodecContext *avctx,
buf = s->frame_buf;
dst = frame->data[0];
- for (i = 0; i < avctx->height; i++) {
- if(version == 0x100) {
+ if (version == 0x100) {
+ for (i = 0; i < avctx->height; i++) {
int j;
const uint8_t *buf1 = buf + (i&3)*(avctx->width/4) + (i/4)*avctx->width;
int stride = (avctx->height/4)*avctx->width;
@@ -401,12 +401,12 @@ static int dfa_decode_frame(AVCodecContext *avctx,
for(; j < avctx->width; j++) {
dst[j] = buf1[(j/4) + (j&3)*stride];
}
- } else {
- memcpy(dst, buf, avctx->width);
- buf += avctx->width;
+ dst += frame->linesize[0];
}
- dst += frame->linesize[0];
- }
+ } else
+ av_image_copy_plane(dst, frame->linesize[0], buf, avctx->width,
+ avctx->width, avctx->height);
+
memcpy(frame->data[1], s->pal, sizeof(s->pal));
*got_frame = 1;