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 1/8] libavcodec/jpeg2000_parser: Speed up long skips
@ 2022-05-31  9:58 Tomas Härdin
  2022-05-31  9:59 ` [FFmpeg-devel] [PATCH 2/8] libavcodec/jpeg2000_parser: Simplify, fix reset_context() Tomas Härdin
                   ` (9 more replies)
  0 siblings, 10 replies; 24+ messages in thread
From: Tomas Härdin @ 2022-05-31  9:58 UTC (permalink / raw)
  To: FFmpeg development discussions and patches

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



[-- Attachment #2: 0001-libavcodec-jpeg2000_parser-Speed-up-long-skips.patch --]
[-- Type: text/x-patch, Size: 1251 bytes --]

From fedd7f9ae2c691a25c37be935d7547be61d46017 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Tomas=20H=C3=A4rdin?= <git@haerdin.se>
Date: Fri, 20 May 2022 11:38:25 +0200
Subject: [PATCH 1/8] libavcodec/jpeg2000_parser: Speed up long skips

---
 libavcodec/jpeg2000_parser.c | 11 +++++++++++
 1 file changed, 11 insertions(+)

diff --git a/libavcodec/jpeg2000_parser.c b/libavcodec/jpeg2000_parser.c
index 2975e71482..9fac958dfa 100644
--- a/libavcodec/jpeg2000_parser.c
+++ b/libavcodec/jpeg2000_parser.c
@@ -95,6 +95,17 @@ static int find_frame_end(JPEG2000ParserContext *m, const uint8_t *buf, int buf_
         state64 = state64 << 8 | buf[i];
         m->bytes_read++;
         if (m->skip_bytes) {
+            // handle long skips
+            if (m->skip_bytes > 8) {
+                // need -9 else buf_size - i == 8 ==> i == buf_size after this,
+                // and thus i == buf_size + 1 after the loop
+                int64_t skip = FFMIN(m->skip_bytes - 8, buf_size - i - 9);
+                if (skip > 0) {
+                    m->skip_bytes -= skip;
+                    i += skip;
+                    m->bytes_read += skip;
+                }
+            }
             m->skip_bytes--;
             continue;
         }
-- 
2.30.2


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

end of thread, other threads:[~2022-06-10  9:12 UTC | newest]

Thread overview: 24+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-05-31  9:58 [FFmpeg-devel] [PATCH 1/8] libavcodec/jpeg2000_parser: Speed up long skips Tomas Härdin
2022-05-31  9:59 ` [FFmpeg-devel] [PATCH 2/8] libavcodec/jpeg2000_parser: Simplify, fix reset_context() Tomas Härdin
2022-06-01 16:50   ` Michael Niedermayer
2022-05-31  9:59 ` [FFmpeg-devel] [PATCH 3/8] libavcodec/jpeg2000_parser: next_state is just a temporary Tomas Härdin
2022-06-01 16:43   ` Michael Niedermayer
2022-05-31 10:00 ` [FFmpeg-devel] [PATCH 4/8] libavcodec/jpeg2000_parser: LUTify info_marker() Tomas Härdin
2022-06-01 16:40   ` Michael Niedermayer
2022-05-31 10:00 ` [FFmpeg-devel] [PATCH 5/8] libavcodec/jpeg2000_parser: Rearrange ifs Tomas Härdin
2022-06-01 16:36   ` Michael Niedermayer
2022-05-31 10:00 ` [FFmpeg-devel] [PATCH 6/8] libavcodec/jpeg2000_parser: Reindent Tomas Härdin
2022-05-31 10:01 ` [FFmpeg-devel] [PATCH 7/8] libavcodec/jpeg2000_parser: Localize m->bytes_read Tomas Härdin
2022-06-01 16:38   ` Michael Niedermayer
2022-05-31 10:01 ` [FFmpeg-devel] [PATCH 8/8] libavcodec/jpeg2000: Call av_codec_is_encoder() only once in init_prec() Tomas Härdin
2022-06-01 16:34   ` Michael Niedermayer
2022-06-01  9:59 ` [FFmpeg-devel] [PATCH 1/8] libavcodec/jpeg2000_parser: Speed up long skips Anton Khirnov
2022-06-01 12:34   ` Tomas Härdin
2022-06-01 13:29     ` Anton Khirnov
2022-06-01 16:21 ` Michael Niedermayer
2022-06-01 16:23   ` Michael Niedermayer
2022-06-02  9:54     ` Tomas Härdin
2022-06-02 19:19       ` Michael Niedermayer
2022-06-03  9:17         ` Tomas Härdin
2022-06-03 14:58           ` Michael Niedermayer
2022-06-10  9:12 ` Tomas Härdin

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