Git Inbox Mirror of the ffmpeg-devel mailing list - see https://ffmpeg.org/mailman/listinfo/ffmpeg-devel
 help / color / mirror / Atom feed
* [FFmpeg-devel] [PATCH] avcodec/dfa: don't check for the bitstream version on every copied line
@ 2022-03-18  2:13 James Almer
  2022-03-22 12:22 ` James Almer
  0 siblings, 1 reply; 2+ messages in thread
From: James Almer @ 2022-03-18  2:13 UTC (permalink / raw)
  To: ffmpeg-devel

And use av_image_copy_plane() while at it to simplify things for
version != 0x100.

Signed-off-by: James Almer <jamrial@gmail.com>
---
 libavcodec/dfa.c | 14 +++++++-------
 1 file changed, 7 insertions(+), 7 deletions(-)

diff --git a/libavcodec/dfa.c b/libavcodec/dfa.c
index ab78d66763..c29eb76de5 100644
--- a/libavcodec/dfa.c
+++ b/libavcodec/dfa.c
@@ -385,8 +385,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;
@@ -400,12 +400,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;
-- 
2.35.1

_______________________________________________
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-devel

To unsubscribe, visit link above, or email
ffmpeg-devel-request@ffmpeg.org with subject "unsubscribe".

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2022-03-22 12:22 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-03-18  2:13 [FFmpeg-devel] [PATCH] avcodec/dfa: don't check for the bitstream version on every copied line James Almer
2022-03-22 12:22 ` James Almer

Git Inbox Mirror of the ffmpeg-devel mailing list - see https://ffmpeg.org/mailman/listinfo/ffmpeg-devel

This inbox may be cloned and mirrored by anyone:

	git clone --mirror https://master.gitmailbox.com/ffmpegdev/0 ffmpegdev/git/0.git

	# If you have public-inbox 1.1+ installed, you may
	# initialize and index your mirror using the following commands:
	public-inbox-init -V2 ffmpegdev ffmpegdev/ https://master.gitmailbox.com/ffmpegdev \
		ffmpegdev@gitmailbox.com
	public-inbox-index ffmpegdev

Example config snippet for mirrors.


AGPL code for this site: git clone https://public-inbox.org/public-inbox.git