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/mjpegdec: add frame threading for mjpeg decoder
@ 2023-09-07 16:44 Paul B Mahol
  2023-09-07 17:07 ` Andreas Rheinhardt
  2023-09-07 21:17 ` Michael Niedermayer
  0 siblings, 2 replies; 7+ messages in thread
From: Paul B Mahol @ 2023-09-07 16:44 UTC (permalink / raw)
  To: FFmpeg development discussions and patches

[-- Attachment #1: Type: text/plain, Size: 10 bytes --]

Attached.

[-- Attachment #2: 0001-avcodec-mjpegdec-add-frame-threading-for-mjpeg-decod.patch --]
[-- Type: text/x-patch, Size: 1742 bytes --]

From 2cff86b07b56d2923f60923e7dd21a546c2cc6fa Mon Sep 17 00:00:00 2001
From: Paul B Mahol <onemda@gmail.com>
Date: Thu, 7 Sep 2023 18:42:03 +0200
Subject: [PATCH] avcodec/mjpegdec: add frame threading for mjpeg decoder

Signed-off-by: Paul B Mahol <onemda@gmail.com>
---
 libavcodec/mjpegdec.c | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/libavcodec/mjpegdec.c b/libavcodec/mjpegdec.c
index 29f281231c..cc38b6c4a9 100644
--- a/libavcodec/mjpegdec.c
+++ b/libavcodec/mjpegdec.c
@@ -52,12 +52,12 @@
 #include "jpeglsdec.h"
 #include "profiles.h"
 #include "put_bits.h"
+#include "thread.h"
 #include "tiff.h"
 #include "exif.h"
 #include "bytestream.h"
 #include "tiff_common.h"
 
-
 static int init_default_huffman_tables(MJpegDecodeContext *s)
 {
     static const struct {
@@ -753,8 +753,8 @@ int ff_mjpeg_decode_sof(MJpegDecodeContext *s)
         }
 
         av_frame_unref(s->picture_ptr);
-        if (ff_get_buffer(s->avctx, s->picture_ptr, AV_GET_BUFFER_FLAG_REF) < 0)
-            return -1;
+        if ((ret = ff_thread_get_buffer(s->avctx, s->picture_ptr, AV_GET_BUFFER_FLAG_REF)) < 0)
+            return ret;
         s->picture_ptr->pict_type = AV_PICTURE_TYPE_I;
         s->picture_ptr->flags |= AV_FRAME_FLAG_KEY;
         s->got_picture            = 1;
@@ -3006,7 +3006,7 @@ const FFCodec ff_mjpeg_decoder = {
     .close          = ff_mjpeg_decode_end,
     FF_CODEC_DECODE_CB(ff_mjpeg_decode_frame),
     .flush          = decode_flush,
-    .p.capabilities = AV_CODEC_CAP_DR1,
+    .p.capabilities = AV_CODEC_CAP_DR1 | AV_CODEC_CAP_FRAME_THREADS,
     .p.max_lowres   = 3,
     .p.priv_class   = &mjpegdec_class,
     .p.profiles     = NULL_IF_CONFIG_SMALL(ff_mjpeg_profiles),
-- 
2.39.1


[-- Attachment #3: Type: text/plain, Size: 251 bytes --]

_______________________________________________
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] 7+ messages in thread

* Re: [FFmpeg-devel] [PATCH] avcodec/mjpegdec: add frame threading for mjpeg decoder
  2023-09-07 16:44 [FFmpeg-devel] [PATCH] avcodec/mjpegdec: add frame threading for mjpeg decoder Paul B Mahol
@ 2023-09-07 17:07 ` Andreas Rheinhardt
  2023-09-07 17:34   ` Paul B Mahol
  2023-09-07 21:17 ` Michael Niedermayer
  1 sibling, 1 reply; 7+ messages in thread
From: Andreas Rheinhardt @ 2023-09-07 17:07 UTC (permalink / raw)
  To: ffmpeg-devel

Paul B Mahol:
> Attached.
> 
> 

Haven't you sent a patch exactly like this before, which led to Michael
Niedermayer providing a command line where this changes the output?

- Andreas

_______________________________________________
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] 7+ messages in thread

* Re: [FFmpeg-devel] [PATCH] avcodec/mjpegdec: add frame threading for mjpeg decoder
  2023-09-07 17:07 ` Andreas Rheinhardt
@ 2023-09-07 17:34   ` Paul B Mahol
  2023-09-07 17:48     ` Paul B Mahol
  0 siblings, 1 reply; 7+ messages in thread
From: Paul B Mahol @ 2023-09-07 17:34 UTC (permalink / raw)
  To: FFmpeg development discussions and patches

On Thu, Sep 7, 2023 at 7:21 PM Andreas Rheinhardt <
andreas.rheinhardt@outlook.com> wrote:

> Paul B Mahol:
> > Attached.
> >
> >
>
> Haven't you sent a patch exactly like this before, which led to Michael
> Niedermayer providing a command line where this changes the output?
>

That  was not me.

But I know what thread you are referring to.


> - Andreas
>
> _______________________________________________
> 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".
>
_______________________________________________
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] 7+ messages in thread

* Re: [FFmpeg-devel] [PATCH] avcodec/mjpegdec: add frame threading for mjpeg decoder
  2023-09-07 17:34   ` Paul B Mahol
@ 2023-09-07 17:48     ` Paul B Mahol
  0 siblings, 0 replies; 7+ messages in thread
From: Paul B Mahol @ 2023-09-07 17:48 UTC (permalink / raw)
  To: FFmpeg development discussions and patches

On Thu, Sep 7, 2023 at 7:34 PM Paul B Mahol <onemda@gmail.com> wrote:

>
>
> On Thu, Sep 7, 2023 at 7:21 PM Andreas Rheinhardt <
> andreas.rheinhardt@outlook.com> wrote:
>
>> Paul B Mahol:
>> > Attached.
>> >
>> >
>>
>> Haven't you sent a patch exactly like this before, which led to Michael
>> Niedermayer providing a command line where this changes the output?
>>
>
> That  was not me.
>
> But I know what thread you are referring to.
>

Checked that file, my patch does not fix nor break playing of that .avi
That AVI with mjpeg codec is not decoding with latest FFmpeg master code.

Even if I extract mjpeg losslessly from avi It still decodes just fine
without and with this patch applied.


>
>
>> - Andreas
>>
>> _______________________________________________
>> 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".
>>
>
_______________________________________________
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] 7+ messages in thread

* Re: [FFmpeg-devel] [PATCH] avcodec/mjpegdec: add frame threading for mjpeg decoder
  2023-09-07 16:44 [FFmpeg-devel] [PATCH] avcodec/mjpegdec: add frame threading for mjpeg decoder Paul B Mahol
  2023-09-07 17:07 ` Andreas Rheinhardt
@ 2023-09-07 21:17 ` Michael Niedermayer
  2023-09-07 21:39   ` Paul B Mahol
  1 sibling, 1 reply; 7+ messages in thread
From: Michael Niedermayer @ 2023-09-07 21:17 UTC (permalink / raw)
  To: FFmpeg development discussions and patches


[-- Attachment #1.1: Type: text/plain, Size: 2774 bytes --]

On Thu, Sep 07, 2023 at 06:44:40PM +0200, Paul B Mahol wrote:
> Attached.

>  mjpegdec.c |    8 ++++----
>  1 file changed, 4 insertions(+), 4 deletions(-)
> f65de11bf58ea36b071c3501d4fa700d242edf21  0001-avcodec-mjpegdec-add-frame-threading-for-mjpeg-decod.patch
> From 2cff86b07b56d2923f60923e7dd21a546c2cc6fa Mon Sep 17 00:00:00 2001
> From: Paul B Mahol <onemda@gmail.com>
> Date: Thu, 7 Sep 2023 18:42:03 +0200
> Subject: [PATCH] avcodec/mjpegdec: add frame threading for mjpeg decoder
> 
> Signed-off-by: Paul B Mahol <onemda@gmail.com>
> ---
>  libavcodec/mjpegdec.c | 8 ++++----
>  1 file changed, 4 insertions(+), 4 deletions(-)

./ffmpeg  -v -1 -i tickets/1915/m_noint.avi -f framecrc -an -t 1 -
Here the timestamps change and the files output does not look healthy
(looks as if one field is behind)

@@ -645,18 +645,22 @@
 #codec_id 0: rawvideo
 #dimensions 0: 640x480
 #sar 0: 0/1
-0,          0,          0,        1,   614400, 0x51734de4
-0,          2,          2,        1,   614400, 0x9dfe6e90
-0,          4,          4,        1,   614400, 0x16d1f0d5
-0,          6,          6,        1,   614400, 0x67cbb0f0
-0,          8,          8,        1,   614400, 0x40f5223e
-0,         10,         10,        1,   614400, 0xef9a9ba8
-0,         12,         12,        1,   614400, 0x415cb69a
-0,         14,         14,        1,   614400, 0xbebf1993
-0,         16,         16,        1,   614400, 0xe4495f0f
-0,         18,         18,        1,   614400, 0x05a06480
-0,         20,         20,        1,   614400, 0x323bb5eb
-0,         22,         22,        1,   614400, 0x941b44ff
+0,          0,          0,        1,   614400, 0xb7f88313
+0,          1,          1,        1,   614400, 0xeda529e0
+0,          2,          2,        1,   614400, 0x29d53819
+0,          3,          3,        1,   614400, 0x95619af7
+0,          4,          4,        1,   614400, 0xfadb0437
+0,          5,          5,        1,   614400, 0xb2efa298
+0,          6,          6,        1,   614400, 0x8f4312c6
+0,          7,          7,        1,   614400, 0x8968e329
+0,          8,          8,        1,   614400, 0x545954c5
+0,          9,          9,        1,   614400, 0x144cd0b3
+0,         10,         10,        1,   614400, 0x5cd10fe0
+0,         11,         11,        1,   614400, 0x81b8473c
+0,         12,         12,        1,   614400, 0x58808c89
+0,         13,         13,        1,   614400, 0x21371f9f
+0,         14,         14,        1,   614400, 0x7533cd2a
+0,         15,         15,        1,   614400, 0xc2e8ec09




[...]

-- 
Michael     GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB

I have often repented speaking, but never of holding my tongue.
-- Xenocrates

[-- Attachment #1.2: signature.asc --]
[-- Type: application/pgp-signature, Size: 195 bytes --]

[-- Attachment #2: Type: text/plain, Size: 251 bytes --]

_______________________________________________
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] 7+ messages in thread

* Re: [FFmpeg-devel] [PATCH] avcodec/mjpegdec: add frame threading for mjpeg decoder
  2023-09-07 21:17 ` Michael Niedermayer
@ 2023-09-07 21:39   ` Paul B Mahol
  2023-09-07 21:57     ` Michael Niedermayer
  0 siblings, 1 reply; 7+ messages in thread
From: Paul B Mahol @ 2023-09-07 21:39 UTC (permalink / raw)
  To: FFmpeg development discussions and patches

Sorry but I do not have such file, file i have only does 1 frame.
_______________________________________________
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] 7+ messages in thread

* Re: [FFmpeg-devel] [PATCH] avcodec/mjpegdec: add frame threading for mjpeg decoder
  2023-09-07 21:39   ` Paul B Mahol
@ 2023-09-07 21:57     ` Michael Niedermayer
  0 siblings, 0 replies; 7+ messages in thread
From: Michael Niedermayer @ 2023-09-07 21:57 UTC (permalink / raw)
  To: FFmpeg development discussions and patches


[-- Attachment #1.1: Type: text/plain, Size: 412 bytes --]

On Thu, Sep 07, 2023 at 11:39:41PM +0200, Paul B Mahol wrote:
> Sorry but I do not have such file, file i have only does 1 frame.

https://samples.ffmpeg.org/ffmpeg-bugs/trac/ticket1915/

thx

[...]

-- 
Michael     GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB

Good people do not need laws to tell them to act responsibly, while bad
people will find a way around the laws. -- Plato

[-- Attachment #1.2: signature.asc --]
[-- Type: application/pgp-signature, Size: 195 bytes --]

[-- Attachment #2: Type: text/plain, Size: 251 bytes --]

_______________________________________________
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] 7+ messages in thread

end of thread, other threads:[~2023-09-07 21:57 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-09-07 16:44 [FFmpeg-devel] [PATCH] avcodec/mjpegdec: add frame threading for mjpeg decoder Paul B Mahol
2023-09-07 17:07 ` Andreas Rheinhardt
2023-09-07 17:34   ` Paul B Mahol
2023-09-07 17:48     ` Paul B Mahol
2023-09-07 21:17 ` Michael Niedermayer
2023-09-07 21:39   ` Paul B Mahol
2023-09-07 21:57     ` Michael Niedermayer

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