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

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

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



[-- Attachment #2: 0002-libavcodec-jpeg2000_parser-Simplify-fix-reset_contex.patch --]
[-- Type: text/x-patch, Size: 3730 bytes --]

From 4bf4593c0d4cbc36d8fcaabe9e36b39134403c34 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Tomas=20H=C3=A4rdin?= <git@haerdin.se>
Date: Fri, 20 May 2022 11:44:06 +0200
Subject: [PATCH 2/8] libavcodec/jpeg2000_parser: Simplify, fix reset_context()

---
 libavcodec/jpeg2000_parser.c | 23 ++++++++++-------------
 1 file changed, 10 insertions(+), 13 deletions(-)

diff --git a/libavcodec/jpeg2000_parser.c b/libavcodec/jpeg2000_parser.c
index 9fac958dfa..a7f72710e4 100644
--- a/libavcodec/jpeg2000_parser.c
+++ b/libavcodec/jpeg2000_parser.c
@@ -51,7 +51,7 @@ static inline void reset_context(JPEG2000ParserContext *m)
     ParseContext *pc = &m->pc;
 
     pc->frame_start_found= 0;
-    pc->state = 0;
+    pc->state64 = 0;
     m->bytes_read = 0;
     m->ft = 0;
     m->skipped_codestream = 0;
@@ -82,16 +82,14 @@ static int find_frame_end(JPEG2000ParserContext *m, const uint8_t *buf, int buf_
 {
     ParseContext *pc= &m->pc;
     int i;
-    uint32_t state, next_state;
-    uint64_t state64;
-    state= pc->state;
-    state64 = pc->state64;
+    uint32_t next_state;
+    uint64_t state64 = pc->state64;
+
     if (buf_size == 0) {
         return 0;
     }
 
     for (i = 0; i < buf_size; i++) {
-        state = state << 8 | buf[i];
         state64 = state64 << 8 | buf[i];
         m->bytes_read++;
         if (m->skip_bytes) {
@@ -132,9 +130,9 @@ static int find_frame_end(JPEG2000ParserContext *m, const uint8_t *buf, int buf_
             }
             m->fheader_read--;
         }
-        if (state == 0x0000000C && m->bytes_read >= 3) { // Indicates start of JP2 file. Check signature next.
+        if ((state64 & 0xFFFFFFFF) == 0x0000000C && m->bytes_read >= 3) { // Indicates start of JP2 file. Check signature next.
             m->fheader_read = 8;
-        } else if ((state & 0xFFFF) == 0xFF4F) {
+        } else if ((state64 & 0xFFFF) == 0xFF4F) {
             m->in_codestream = 1;
             if (!pc->frame_start_found) {
                 pc->frame_start_found = 1;
@@ -143,7 +141,7 @@ static int find_frame_end(JPEG2000ParserContext *m, const uint8_t *buf, int buf_
                 reset_context(m);
                 return i - 1;
             }
-        } else if ((state & 0xFFFF) == 0xFFD9) {
+        } else if ((state64 & 0xFFFF) == 0xFFD9) {
             if (pc->frame_start_found && m->ft == jp2_file) {
                 m->skipped_codestream = 1;
             } else if (pc->frame_start_found && m->ft == j2k_cstream) {
@@ -151,11 +149,11 @@ static int find_frame_end(JPEG2000ParserContext *m, const uint8_t *buf, int buf_
                 return i + 1; // End of frame detected, return frame size.
             }
             m->in_codestream = 0;
-        } else if (m->in_codestream && (state & 0xFFFF) == 0xFF90) { // Are we in tile part header?
+        } else if (m->in_codestream && (state64 & 0xFFFF) == 0xFF90) { // Are we in tile part header?
             m->read_tp = 8;
-        } else if (pc->frame_start_found && info_marker((state & 0xFFFF0000)>>16) && m->in_codestream && (state & 0xFFFF)) {
+        } else if (pc->frame_start_found && info_marker((state64 & 0xFFFF0000)>>16) && m->in_codestream && (state64 & 0xFFFF)) {
             // Calculate number of bytes to skip to get to end of the next marker.
-            m->skip_bytes = (state & 0xFFFF)-1;
+            m->skip_bytes = (state64 & 0xFFFF)-1;
 
             // If the next marker is an info marker, skip to the end of of the marker length.
             if (i + m->skip_bytes + 1 < buf_size) {
@@ -168,7 +166,6 @@ static int find_frame_end(JPEG2000ParserContext *m, const uint8_t *buf, int buf_
         }
     }
 
-    pc->state = state;
     pc->state64 = state64;
     return END_NOT_FOUND;
 }
-- 
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

* [FFmpeg-devel] [PATCH 3/8] libavcodec/jpeg2000_parser: next_state is just a temporary
  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-05-31  9:59 ` 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
                   ` (7 subsequent siblings)
  9 siblings, 1 reply; 24+ messages in thread
From: Tomas Härdin @ 2022-05-31  9:59 UTC (permalink / raw)
  To: FFmpeg development discussions and patches

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



[-- Attachment #2: 0003-libavcodec-jpeg2000_parser-next_state-is-just-a-temp.patch --]
[-- Type: text/x-patch, Size: 1384 bytes --]

From 682701613a9b816aac9e75848216e3c7e6a12974 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Tomas=20H=C3=A4rdin?= <git@haerdin.se>
Date: Fri, 20 May 2022 11:45:23 +0200
Subject: [PATCH 3/8] libavcodec/jpeg2000_parser: next_state is just a
 temporary

---
 libavcodec/jpeg2000_parser.c | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

diff --git a/libavcodec/jpeg2000_parser.c b/libavcodec/jpeg2000_parser.c
index a7f72710e4..c6d8416d43 100644
--- a/libavcodec/jpeg2000_parser.c
+++ b/libavcodec/jpeg2000_parser.c
@@ -82,7 +82,6 @@ static int find_frame_end(JPEG2000ParserContext *m, const uint8_t *buf, int buf_
 {
     ParseContext *pc= &m->pc;
     int i;
-    uint32_t next_state;
     uint64_t state64 = pc->state64;
 
     if (buf_size == 0) {
@@ -157,7 +156,7 @@ static int find_frame_end(JPEG2000ParserContext *m, const uint8_t *buf, int buf_
 
             // If the next marker is an info marker, skip to the end of of the marker length.
             if (i + m->skip_bytes + 1 < buf_size) {
-                next_state = (buf[i + m->skip_bytes] << 8) | buf[i + m->skip_bytes + 1];
+                uint32_t next_state = (buf[i + m->skip_bytes] << 8) | buf[i + m->skip_bytes + 1];
                 if (info_marker(next_state)) {
                     // Skip an additional 2 bytes to get to the end of the marker length.
                     m->skip_bytes += 2;
-- 
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

* [FFmpeg-devel] [PATCH 4/8] libavcodec/jpeg2000_parser: LUTify info_marker()
  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-05-31  9:59 ` [FFmpeg-devel] [PATCH 3/8] libavcodec/jpeg2000_parser: next_state is just a temporary Tomas Härdin
@ 2022-05-31 10:00 ` 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
                   ` (6 subsequent siblings)
  9 siblings, 1 reply; 24+ messages in thread
From: Tomas Härdin @ 2022-05-31 10:00 UTC (permalink / raw)
  To: FFmpeg development discussions and patches

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



[-- Attachment #2: 0004-libavcodec-jpeg2000_parser-LUTify-info_marker.patch --]
[-- Type: text/x-patch, Size: 2011 bytes --]

From d84f106d1eac7a3ea98935d11dc65e0afe8a8fb6 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Tomas=20H=C3=A4rdin?= <git@haerdin.se>
Date: Fri, 20 May 2022 14:41:38 +0200
Subject: [PATCH 4/8] libavcodec/jpeg2000_parser: LUTify info_marker()

This speeds find_frame_end() up by 39% according to valgrind
---
 libavcodec/jpeg2000_parser.c | 26 +++++++++++++++++++-------
 1 file changed, 19 insertions(+), 7 deletions(-)

diff --git a/libavcodec/jpeg2000_parser.c b/libavcodec/jpeg2000_parser.c
index c6d8416d43..88e4a142f8 100644
--- a/libavcodec/jpeg2000_parser.c
+++ b/libavcodec/jpeg2000_parser.c
@@ -65,13 +65,25 @@ static inline void reset_context(JPEG2000ParserContext *m)
 */
 static uint8_t info_marker(uint16_t marker)
 {
-    if (marker == 0xFF92 || marker == 0xFF4F ||
-        marker == 0xFF90 || marker == 0xFF93 ||
-        marker == 0xFFD9)
-        return 0;
-    else
-        if (marker > 0xFF00) return 1;
-    return 0;
+    static const uint8_t lut[256] = {
+        1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
+        1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
+        1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
+        1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
+        1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, // 0xFF4F
+        1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
+        1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
+        1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
+        1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
+        0, 1, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, // 0xFF90 0xFF92 0xFF93
+        1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
+        1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
+        1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
+        1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 1, 1, 1, 1, 1, 1, // 0xFFD9
+        1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
+        1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
+    };
+    return marker < 0xFF00 ? 0 : lut[marker & 0xFF];
 }
 
 /**
-- 
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

* [FFmpeg-devel] [PATCH 5/8] libavcodec/jpeg2000_parser: Rearrange ifs
  2022-05-31  9:58 [FFmpeg-devel] [PATCH 1/8] libavcodec/jpeg2000_parser: Speed up long skips Tomas Härdin
                   ` (2 preceding siblings ...)
  2022-05-31 10:00 ` [FFmpeg-devel] [PATCH 4/8] libavcodec/jpeg2000_parser: LUTify info_marker() Tomas Härdin
@ 2022-05-31 10:00 ` 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
                   ` (5 subsequent siblings)
  9 siblings, 1 reply; 24+ messages in thread
From: Tomas Härdin @ 2022-05-31 10:00 UTC (permalink / raw)
  To: FFmpeg development discussions and patches

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



[-- Attachment #2: 0005-libavcodec-jpeg2000_parser-Rearrange-ifs.patch --]
[-- Type: text/x-patch, Size: 1604 bytes --]

From 68add7a3abb85d84e484ae58b1661d7bbf66c04d Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Tomas=20H=C3=A4rdin?= <git@haerdin.se>
Date: Fri, 20 May 2022 14:44:54 +0200
Subject: [PATCH 5/8] libavcodec/jpeg2000_parser: Rearrange ifs

A modest 8% improvement
---
 libavcodec/jpeg2000_parser.c | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)

diff --git a/libavcodec/jpeg2000_parser.c b/libavcodec/jpeg2000_parser.c
index 88e4a142f8..bd966b3acf 100644
--- a/libavcodec/jpeg2000_parser.c
+++ b/libavcodec/jpeg2000_parser.c
@@ -160,9 +160,10 @@ static int find_frame_end(JPEG2000ParserContext *m, const uint8_t *buf, int buf_
                 return i + 1; // End of frame detected, return frame size.
             }
             m->in_codestream = 0;
-        } else if (m->in_codestream && (state64 & 0xFFFF) == 0xFF90) { // Are we in tile part header?
+        } else if (m->in_codestream) {
+          if ((state64 & 0xFFFF) == 0xFF90) { // Are we in tile part header?
             m->read_tp = 8;
-        } else if (pc->frame_start_found && info_marker((state64 & 0xFFFF0000)>>16) && m->in_codestream && (state64 & 0xFFFF)) {
+          } else if (info_marker((state64 & 0xFFFF0000)>>16) && pc->frame_start_found && (state64 & 0xFFFF)) {
             // Calculate number of bytes to skip to get to end of the next marker.
             m->skip_bytes = (state64 & 0xFFFF)-1;
 
@@ -174,6 +175,7 @@ static int find_frame_end(JPEG2000ParserContext *m, const uint8_t *buf, int buf_
                     m->skip_bytes += 2;
                 }
             }
+          }
         }
     }
 
-- 
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

* [FFmpeg-devel] [PATCH 6/8] libavcodec/jpeg2000_parser: Reindent
  2022-05-31  9:58 [FFmpeg-devel] [PATCH 1/8] libavcodec/jpeg2000_parser: Speed up long skips Tomas Härdin
                   ` (3 preceding siblings ...)
  2022-05-31 10:00 ` [FFmpeg-devel] [PATCH 5/8] libavcodec/jpeg2000_parser: Rearrange ifs Tomas Härdin
@ 2022-05-31 10:00 ` Tomas Härdin
  2022-05-31 10:01 ` [FFmpeg-devel] [PATCH 7/8] libavcodec/jpeg2000_parser: Localize m->bytes_read Tomas Härdin
                   ` (4 subsequent siblings)
  9 siblings, 0 replies; 24+ messages in thread
From: Tomas Härdin @ 2022-05-31 10:00 UTC (permalink / raw)
  To: FFmpeg development discussions and patches

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



[-- Attachment #2: 0006-libavcodec-jpeg2000_parser-Reindent.patch --]
[-- Type: text/x-patch, Size: 2421 bytes --]

From 96fc66ca55a306575faf6d3b17ea58aae4c6c046 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Tomas=20H=C3=A4rdin?= <git@haerdin.se>
Date: Tue, 31 May 2022 11:37:55 +0200
Subject: [PATCH 6/8] libavcodec/jpeg2000_parser: Reindent

---
 libavcodec/jpeg2000_parser.c | 26 +++++++++++++-------------
 1 file changed, 13 insertions(+), 13 deletions(-)

diff --git a/libavcodec/jpeg2000_parser.c b/libavcodec/jpeg2000_parser.c
index bd966b3acf..e66ef0e1f0 100644
--- a/libavcodec/jpeg2000_parser.c
+++ b/libavcodec/jpeg2000_parser.c
@@ -161,21 +161,21 @@ static int find_frame_end(JPEG2000ParserContext *m, const uint8_t *buf, int buf_
             }
             m->in_codestream = 0;
         } else if (m->in_codestream) {
-          if ((state64 & 0xFFFF) == 0xFF90) { // Are we in tile part header?
-            m->read_tp = 8;
-          } else if (info_marker((state64 & 0xFFFF0000)>>16) && pc->frame_start_found && (state64 & 0xFFFF)) {
-            // Calculate number of bytes to skip to get to end of the next marker.
-            m->skip_bytes = (state64 & 0xFFFF)-1;
-
-            // If the next marker is an info marker, skip to the end of of the marker length.
-            if (i + m->skip_bytes + 1 < buf_size) {
-                uint32_t next_state = (buf[i + m->skip_bytes] << 8) | buf[i + m->skip_bytes + 1];
-                if (info_marker(next_state)) {
-                    // Skip an additional 2 bytes to get to the end of the marker length.
-                    m->skip_bytes += 2;
+            if ((state64 & 0xFFFF) == 0xFF90) { // Are we in tile part header?
+                m->read_tp = 8;
+            } else if (info_marker((state64 & 0xFFFF0000)>>16) && pc->frame_start_found && (state64 & 0xFFFF)) {
+                // Calculate number of bytes to skip to get to end of the next marker.
+                m->skip_bytes = (state64 & 0xFFFF)-1;
+
+                // If the next marker is an info marker, skip to the end of of the marker length.
+                if (i + m->skip_bytes + 1 < buf_size) {
+                    uint32_t next_state = (buf[i + m->skip_bytes] << 8) | buf[i + m->skip_bytes + 1];
+                    if (info_marker(next_state)) {
+                        // Skip an additional 2 bytes to get to the end of the marker length.
+                        m->skip_bytes += 2;
+                    }
                 }
             }
-          }
         }
     }
 
-- 
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

* [FFmpeg-devel] [PATCH 7/8] libavcodec/jpeg2000_parser: Localize m->bytes_read
  2022-05-31  9:58 [FFmpeg-devel] [PATCH 1/8] libavcodec/jpeg2000_parser: Speed up long skips Tomas Härdin
                   ` (4 preceding siblings ...)
  2022-05-31 10:00 ` [FFmpeg-devel] [PATCH 6/8] libavcodec/jpeg2000_parser: Reindent Tomas Härdin
@ 2022-05-31 10:01 ` 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
                   ` (3 subsequent siblings)
  9 siblings, 1 reply; 24+ messages in thread
From: Tomas Härdin @ 2022-05-31 10:01 UTC (permalink / raw)
  To: FFmpeg development discussions and patches

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



[-- Attachment #2: 0007-libavcodec-jpeg2000_parser-Localize-m-bytes_read.patch --]
[-- Type: text/x-patch, Size: 2235 bytes --]

From 7b5e442033f0691bddbe2c2a0292f4abffd46c3d Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Tomas=20H=C3=A4rdin?= <git@haerdin.se>
Date: Fri, 20 May 2022 14:50:00 +0200
Subject: [PATCH 7/8] libavcodec/jpeg2000_parser: Localize m->bytes_read

Another 6%
---
 libavcodec/jpeg2000_parser.c | 8 +++++---
 1 file changed, 5 insertions(+), 3 deletions(-)

diff --git a/libavcodec/jpeg2000_parser.c b/libavcodec/jpeg2000_parser.c
index e66ef0e1f0..de73196855 100644
--- a/libavcodec/jpeg2000_parser.c
+++ b/libavcodec/jpeg2000_parser.c
@@ -95,6 +95,7 @@ static int find_frame_end(JPEG2000ParserContext *m, const uint8_t *buf, int buf_
     ParseContext *pc= &m->pc;
     int i;
     uint64_t state64 = pc->state64;
+    uint64_t bytes_read = m->bytes_read;
 
     if (buf_size == 0) {
         return 0;
@@ -102,7 +103,7 @@ static int find_frame_end(JPEG2000ParserContext *m, const uint8_t *buf, int buf_
 
     for (i = 0; i < buf_size; i++) {
         state64 = state64 << 8 | buf[i];
-        m->bytes_read++;
+        bytes_read++;
         if (m->skip_bytes) {
             // handle long skips
             if (m->skip_bytes > 8) {
@@ -112,7 +113,7 @@ static int find_frame_end(JPEG2000ParserContext *m, const uint8_t *buf, int buf_
                 if (skip > 0) {
                     m->skip_bytes -= skip;
                     i += skip;
-                    m->bytes_read += skip;
+                    bytes_read += skip;
                 }
             }
             m->skip_bytes--;
@@ -141,7 +142,7 @@ static int find_frame_end(JPEG2000ParserContext *m, const uint8_t *buf, int buf_
             }
             m->fheader_read--;
         }
-        if ((state64 & 0xFFFFFFFF) == 0x0000000C && m->bytes_read >= 3) { // Indicates start of JP2 file. Check signature next.
+        if ((state64 & 0xFFFFFFFF) == 0x0000000C && bytes_read >= 3) { // Indicates start of JP2 file. Check signature next.
             m->fheader_read = 8;
         } else if ((state64 & 0xFFFF) == 0xFF4F) {
             m->in_codestream = 1;
@@ -180,6 +181,7 @@ static int find_frame_end(JPEG2000ParserContext *m, const uint8_t *buf, int buf_
     }
 
     pc->state64 = state64;
+    m->bytes_read = bytes_read;
     return END_NOT_FOUND;
 }
 
-- 
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

* [FFmpeg-devel] [PATCH 8/8] libavcodec/jpeg2000: Call av_codec_is_encoder() only once in init_prec()
  2022-05-31  9:58 [FFmpeg-devel] [PATCH 1/8] libavcodec/jpeg2000_parser: Speed up long skips Tomas Härdin
                   ` (5 preceding siblings ...)
  2022-05-31 10:01 ` [FFmpeg-devel] [PATCH 7/8] libavcodec/jpeg2000_parser: Localize m->bytes_read Tomas Härdin
@ 2022-05-31 10:01 ` 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
                   ` (2 subsequent siblings)
  9 siblings, 1 reply; 24+ messages in thread
From: Tomas Härdin @ 2022-05-31 10:01 UTC (permalink / raw)
  To: FFmpeg development discussions and patches

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



[-- Attachment #2: 0008-libavcodec-jpeg2000-Call-av_codec_is_encoder-only-on.patch --]
[-- Type: text/x-patch, Size: 1530 bytes --]

From 1485b06278f38dcda5ff83f17e0a3446949809b6 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Tomas=20H=C3=A4rdin?= <git@haerdin.se>
Date: Mon, 23 May 2022 11:20:57 +0200
Subject: [PATCH 8/8] libavcodec/jpeg2000: Call av_codec_is_encoder() only once
 in init_prec()

---
 libavcodec/jpeg2000.c | 7 +++++--
 1 file changed, 5 insertions(+), 2 deletions(-)

diff --git a/libavcodec/jpeg2000.c b/libavcodec/jpeg2000.c
index 0aa984bc53..0d4b18b38d 100644
--- a/libavcodec/jpeg2000.c
+++ b/libavcodec/jpeg2000.c
@@ -278,7 +278,7 @@ static int init_prec(AVCodecContext *avctx,
                      int log2_band_prec_height)
 {
     Jpeg2000Prec *prec = band->prec + precno;
-    int nb_codeblocks, cblkno;
+    int nb_codeblocks, cblkno, is_enc;
 
     prec->decoded_layers = 0;
 
@@ -336,6 +336,9 @@ static int init_prec(AVCodecContext *avctx,
     prec->cblk = av_calloc(nb_codeblocks, sizeof(*prec->cblk));
     if (!prec->cblk)
         return AVERROR(ENOMEM);
+
+    is_enc = av_codec_is_encoder(avctx->codec);
+
     for (cblkno = 0; cblkno < nb_codeblocks; cblkno++) {
         Jpeg2000Cblk *cblk = prec->cblk + cblkno;
         int Cx0, Cy0;
@@ -375,7 +378,7 @@ static int init_prec(AVCodecContext *avctx,
         cblk->lblock    = 3;
         cblk->length    = 0;
         cblk->npasses   = 0;
-        if (av_codec_is_encoder(avctx->codec)) {
+        if (is_enc) {
             cblk->layers = av_calloc(codsty->nlayers, sizeof(*cblk->layers));
             if (!cblk->layers)
                 return AVERROR(ENOMEM);
-- 
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

* Re: [FFmpeg-devel] [PATCH 1/8] libavcodec/jpeg2000_parser: Speed up long skips
  2022-05-31  9:58 [FFmpeg-devel] [PATCH 1/8] libavcodec/jpeg2000_parser: Speed up long skips Tomas Härdin
                   ` (6 preceding siblings ...)
  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  9:59 ` Anton Khirnov
  2022-06-01 12:34   ` Tomas Härdin
  2022-06-01 16:21 ` Michael Niedermayer
  2022-06-10  9:12 ` Tomas Härdin
  9 siblings, 1 reply; 24+ messages in thread
From: Anton Khirnov @ 2022-06-01  9:59 UTC (permalink / raw)
  To: FFmpeg development discussions and patches

Quoting Tomas Härdin (2022-05-31 11:58:39)
> 
> 
> 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;

Shouldn't you also update state(64)?

-- 
Anton Khirnov
_______________________________________________
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

* Re: [FFmpeg-devel] [PATCH 1/8] libavcodec/jpeg2000_parser: Speed up long skips
  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
  0 siblings, 1 reply; 24+ messages in thread
From: Tomas Härdin @ 2022-06-01 12:34 UTC (permalink / raw)
  To: FFmpeg development discussions and patches

ons 2022-06-01 klockan 11:59 +0200 skrev Anton Khirnov:
> Quoting Tomas Härdin (2022-05-31 11:58:39)
> > 
> > 
> > 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;
> 
> Shouldn't you also update state(64)?
> 

It gets updated after 8 more skips. Keep in mind the buffer may end
before the skip is fully done, so I can't just AV_RB64().

/Tomas

_______________________________________________
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

* Re: [FFmpeg-devel] [PATCH 1/8] libavcodec/jpeg2000_parser: Speed up long skips
  2022-06-01 12:34   ` Tomas Härdin
@ 2022-06-01 13:29     ` Anton Khirnov
  0 siblings, 0 replies; 24+ messages in thread
From: Anton Khirnov @ 2022-06-01 13:29 UTC (permalink / raw)
  To: FFmpeg development discussions and patches

Quoting Tomas Härdin (2022-06-01 14:34:57)
> ons 2022-06-01 klockan 11:59 +0200 skrev Anton Khirnov:
> > Quoting Tomas Härdin (2022-05-31 11:58:39)
> > > 
> > > 
> > > 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;
> > 
> > Shouldn't you also update state(64)?
> > 
> 
> It gets updated after 8 more skips. Keep in mind the buffer may end
> before the skip is fully done, so I can't just AV_RB64().

Ah right, nevermind then. Set looks good to me.

-- 
Anton Khirnov
_______________________________________________
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

* Re: [FFmpeg-devel] [PATCH 1/8] libavcodec/jpeg2000_parser: Speed up long skips
  2022-05-31  9:58 [FFmpeg-devel] [PATCH 1/8] libavcodec/jpeg2000_parser: Speed up long skips Tomas Härdin
                   ` (7 preceding siblings ...)
  2022-06-01  9:59 ` [FFmpeg-devel] [PATCH 1/8] libavcodec/jpeg2000_parser: Speed up long skips Anton Khirnov
@ 2022-06-01 16:21 ` Michael Niedermayer
  2022-06-01 16:23   ` Michael Niedermayer
  2022-06-10  9:12 ` Tomas Härdin
  9 siblings, 1 reply; 24+ messages in thread
From: Michael Niedermayer @ 2022-06-01 16:21 UTC (permalink / raw)
  To: FFmpeg development discussions and patches


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

On Tue, May 31, 2022 at 11:58:39AM +0200, Tomas Härdin wrote:
> 

>  jpeg2000_parser.c |   11 +++++++++++
>  1 file changed, 11 insertions(+)
> 634546fb5a0eb281eea87ad7471c503f5bc9e8ab  0001-libavcodec-jpeg2000_parser-Speed-up-long-skips.patch
> 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(+)

breaks
j2kref/codestreams_profile1/p1_04.j2k

[...]

-- 
Michael     GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB

Elect your leaders based on what they did after the last election, not
based on what they say before an election.


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

* Re: [FFmpeg-devel] [PATCH 1/8] libavcodec/jpeg2000_parser: Speed up long skips
  2022-06-01 16:21 ` Michael Niedermayer
@ 2022-06-01 16:23   ` Michael Niedermayer
  2022-06-02  9:54     ` Tomas Härdin
  0 siblings, 1 reply; 24+ messages in thread
From: Michael Niedermayer @ 2022-06-01 16:23 UTC (permalink / raw)
  To: FFmpeg development discussions and patches


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

On Wed, Jun 01, 2022 at 06:21:19PM +0200, Michael Niedermayer wrote:
> On Tue, May 31, 2022 at 11:58:39AM +0200, Tomas Härdin wrote:
> > 
> 
> >  jpeg2000_parser.c |   11 +++++++++++
> >  1 file changed, 11 insertions(+)
> > 634546fb5a0eb281eea87ad7471c503f5bc9e8ab  0001-libavcodec-jpeg2000_parser-Speed-up-long-skips.patch
> > 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(+)
> 
> breaks
> j2kref/codestreams_profile1/p1_04.j2k

[jpeg2000 @ 0x7fb0b8002600] Psot 66195 too big
[jpeg2000 @ 0x7fb0b8002600] error during processing marker segment ff90
Input #0, j2k_pipe, from 'j2kref/codestreams_profile1/p1_04.j2k':
  Duration: N/A, bitrate: N/A
  Stream #0:0: Video: jpeg2000 (JPEG 2000 codestream restriction 1), gray16le(12 bpc), 1024x1024, 25 fps, 25 tbr, 25 tbn
[jpeg2000 @ 0x7fb0b8003240] unsupported marker 0x97C8 at pos 0x6F0
[jpeg2000 @ 0x7fb0b8003240] Missing EOC Marker.
[jpeg2000 @ 0x7fb0b8032280] unsupported marker 0x97C8 at pos 0x6F0
[jpeg2000 @ 0x7fb0b8032280] Missing EOC Marker.
[jpeg2000 @ 0x7fb0b8006280] Psot 66195 too big
[jpeg2000 @ 0x7fb0b8006280] error during processing marker segment ff90


[...]


-- 
Michael     GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB

The real ebay dictionary, page 2
"100% positive feedback" - "All either got their money back or didnt complain"
"Best seller ever, very honest" - "Seller refunded buyer after failed scam"

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

* Re: [FFmpeg-devel] [PATCH 8/8] libavcodec/jpeg2000: Call av_codec_is_encoder() only once in init_prec()
  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
  0 siblings, 0 replies; 24+ messages in thread
From: Michael Niedermayer @ 2022-06-01 16:34 UTC (permalink / raw)
  To: FFmpeg development discussions and patches


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

On Tue, May 31, 2022 at 12:01:35PM +0200, Tomas Härdin wrote:
> 

>  jpeg2000.c |    7 +++++--
>  1 file changed, 5 insertions(+), 2 deletions(-)
> 05721f386bc015c4402f70bdb14dd6a8931a4429  0008-libavcodec-jpeg2000-Call-av_codec_is_encoder-only-on.patch
> From 1485b06278f38dcda5ff83f17e0a3446949809b6 Mon Sep 17 00:00:00 2001
> From: =?UTF-8?q?Tomas=20H=C3=A4rdin?= <git@haerdin.se>
> Date: Mon, 23 May 2022 11:20:57 +0200
> Subject: [PATCH 8/8] libavcodec/jpeg2000: Call av_codec_is_encoder() only once
>  in init_prec()

LGTM

thx

[...]

-- 
Michael     GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB

Democracy is the form of government in which you can choose your dictator

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

* Re: [FFmpeg-devel] [PATCH 5/8] libavcodec/jpeg2000_parser: Rearrange ifs
  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
  0 siblings, 0 replies; 24+ messages in thread
From: Michael Niedermayer @ 2022-06-01 16:36 UTC (permalink / raw)
  To: FFmpeg development discussions and patches


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

On Tue, May 31, 2022 at 12:00:26PM +0200, Tomas Härdin wrote:
> 

>  jpeg2000_parser.c |    6 ++++--
>  1 file changed, 4 insertions(+), 2 deletions(-)
> b0a91cd73f5b4887a9d87518bc16ed6e1f104a39  0005-libavcodec-jpeg2000_parser-Rearrange-ifs.patch
> From 68add7a3abb85d84e484ae58b1661d7bbf66c04d Mon Sep 17 00:00:00 2001
> From: =?UTF-8?q?Tomas=20H=C3=A4rdin?= <git@haerdin.se>
> Date: Fri, 20 May 2022 14:44:54 +0200
> Subject: [PATCH 5/8] libavcodec/jpeg2000_parser: Rearrange ifs
> 
> A modest 8% improvement
> ---
>  libavcodec/jpeg2000_parser.c | 6 ++++--
>  1 file changed, 4 insertions(+), 2 deletions(-)

LGTM

thx

[...]

-- 
Michael     GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB

The worst form of inequality is to try to make unequal things equal.
-- Aristotle

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

* Re: [FFmpeg-devel] [PATCH 7/8] libavcodec/jpeg2000_parser: Localize m->bytes_read
  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
  0 siblings, 0 replies; 24+ messages in thread
From: Michael Niedermayer @ 2022-06-01 16:38 UTC (permalink / raw)
  To: FFmpeg development discussions and patches


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

On Tue, May 31, 2022 at 12:01:12PM +0200, Tomas Härdin wrote:
> 

>  jpeg2000_parser.c |    8 +++++---
>  1 file changed, 5 insertions(+), 3 deletions(-)
> a16f2b29057a6e89ef7a03529fb4c66ecc704094  0007-libavcodec-jpeg2000_parser-Localize-m-bytes_read.patch
> From 7b5e442033f0691bddbe2c2a0292f4abffd46c3d Mon Sep 17 00:00:00 2001
> From: =?UTF-8?q?Tomas=20H=C3=A4rdin?= <git@haerdin.se>
> Date: Fri, 20 May 2022 14:50:00 +0200
> Subject: [PATCH 7/8] libavcodec/jpeg2000_parser: Localize m->bytes_read
> 
> Another 6%
> ---
>  libavcodec/jpeg2000_parser.c | 8 +++++---
>  1 file changed, 5 insertions(+), 3 deletions(-)

This didnt apply without #1 so i could not test but it should be ok

thx

[...]

-- 
Michael     GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB

Old school: Use the lowest level language in which you can solve the problem
            conveniently.
New school: Use the highest level language in which the latest supercomputer
            can solve the problem without the user falling asleep waiting.

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

* Re: [FFmpeg-devel] [PATCH 4/8] libavcodec/jpeg2000_parser: LUTify info_marker()
  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
  0 siblings, 0 replies; 24+ messages in thread
From: Michael Niedermayer @ 2022-06-01 16:40 UTC (permalink / raw)
  To: FFmpeg development discussions and patches


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

On Tue, May 31, 2022 at 12:00:05PM +0200, Tomas Härdin wrote:
> 

>  jpeg2000_parser.c |   26 +++++++++++++++++++-------
>  1 file changed, 19 insertions(+), 7 deletions(-)
> 7661a5b239a94ccba349c916a390d957479a9771  0004-libavcodec-jpeg2000_parser-LUTify-info_marker.patch
> From d84f106d1eac7a3ea98935d11dc65e0afe8a8fb6 Mon Sep 17 00:00:00 2001
> From: =?UTF-8?q?Tomas=20H=C3=A4rdin?= <git@haerdin.se>
> Date: Fri, 20 May 2022 14:41:38 +0200
> Subject: [PATCH 4/8] libavcodec/jpeg2000_parser: LUTify info_marker()
> 
> This speeds find_frame_end() up by 39% according to valgrind
> ---
>  libavcodec/jpeg2000_parser.c | 26 +++++++++++++++++++-------
>  1 file changed, 19 insertions(+), 7 deletions(-)

LGTM

thx

[...]

-- 
Michael     GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB

The real ebay dictionary, page 2
"100% positive feedback" - "All either got their money back or didnt complain"
"Best seller ever, very honest" - "Seller refunded buyer after failed scam"

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

* Re: [FFmpeg-devel] [PATCH 3/8] libavcodec/jpeg2000_parser: next_state is just a temporary
  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
  0 siblings, 0 replies; 24+ messages in thread
From: Michael Niedermayer @ 2022-06-01 16:43 UTC (permalink / raw)
  To: FFmpeg development discussions and patches


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

On Tue, May 31, 2022 at 11:59:42AM +0200, Tomas Härdin wrote:
> 

>  jpeg2000_parser.c |    3 +--
>  1 file changed, 1 insertion(+), 2 deletions(-)
> c4714ab68e0049d0ee84e5c7f89582c5426c10ad  0003-libavcodec-jpeg2000_parser-next_state-is-just-a-temp.patch
> From 682701613a9b816aac9e75848216e3c7e6a12974 Mon Sep 17 00:00:00 2001
> From: =?UTF-8?q?Tomas=20H=C3=A4rdin?= <git@haerdin.se>
> Date: Fri, 20 May 2022 11:45:23 +0200
> Subject: [PATCH 3/8] libavcodec/jpeg2000_parser: next_state is just a
>  temporary
> 
> ---
>  libavcodec/jpeg2000_parser.c | 3 +--
>  1 file changed, 1 insertion(+), 2 deletions(-)

LGTM

thx

[...]

-- 
Michael     GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB

No snowflake in an avalanche ever feels responsible. -- Voltaire

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

* Re: [FFmpeg-devel] [PATCH 2/8] libavcodec/jpeg2000_parser: Simplify, fix reset_context()
  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
  0 siblings, 0 replies; 24+ messages in thread
From: Michael Niedermayer @ 2022-06-01 16:50 UTC (permalink / raw)
  To: FFmpeg development discussions and patches


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

On Tue, May 31, 2022 at 11:59:15AM +0200, Tomas Härdin wrote:
> 

>  jpeg2000_parser.c |   23 ++++++++++-------------
>  1 file changed, 10 insertions(+), 13 deletions(-)
> 54fa89b694ebf1b0fb5adf18a5f53a2aabcbc9c9  0002-libavcodec-jpeg2000_parser-Simplify-fix-reset_contex.patch
> From 4bf4593c0d4cbc36d8fcaabe9e36b39134403c34 Mon Sep 17 00:00:00 2001
> From: =?UTF-8?q?Tomas=20H=C3=A4rdin?= <git@haerdin.se>
> Date: Fri, 20 May 2022 11:44:06 +0200
> Subject: [PATCH 2/8] libavcodec/jpeg2000_parser: Simplify, fix reset_context()
> 
> ---
>  libavcodec/jpeg2000_parser.c | 23 ++++++++++-------------
>  1 file changed, 10 insertions(+), 13 deletions(-)

should be ok

thx

[...]

-- 
Michael     GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB

The real ebay dictionary, page 2
"100% positive feedback" - "All either got their money back or didnt complain"
"Best seller ever, very honest" - "Seller refunded buyer after failed scam"

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

* Re: [FFmpeg-devel] [PATCH 1/8] libavcodec/jpeg2000_parser: Speed up long skips
  2022-06-01 16:23   ` Michael Niedermayer
@ 2022-06-02  9:54     ` Tomas Härdin
  2022-06-02 19:19       ` Michael Niedermayer
  0 siblings, 1 reply; 24+ messages in thread
From: Tomas Härdin @ 2022-06-02  9:54 UTC (permalink / raw)
  To: FFmpeg development discussions and patches

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

ons 2022-06-01 klockan 18:23 +0200 skrev Michael Niedermayer:
> On Wed, Jun 01, 2022 at 06:21:19PM +0200, Michael Niedermayer wrote:
> > On Tue, May 31, 2022 at 11:58:39AM +0200, Tomas Härdin wrote:
> > > 
> > 
> > >  jpeg2000_parser.c |   11 +++++++++++
> > >  1 file changed, 11 insertions(+)
> > > 634546fb5a0eb281eea87ad7471c503f5bc9e8ab  0001-libavcodec-
> > > jpeg2000_parser-Speed-up-long-skips.patch
> > > 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(+)
> > 
> > breaks
> > j2kref/codestreams_profile1/p1_04.j2k
> 
> [jpeg2000 @ 0x7fb0b8002600] Psot 66195 too big
> [jpeg2000 @ 0x7fb0b8002600] error during processing marker segment
> ff90
> Input #0, j2k_pipe, from 'j2kref/codestreams_profile1/p1_04.j2k':
>   Duration: N/A, bitrate: N/A
>   Stream #0:0: Video: jpeg2000 (JPEG 2000 codestream restriction 1),
> gray16le(12 bpc), 1024x1024, 25 fps, 25 tbr, 25 tbn
> [jpeg2000 @ 0x7fb0b8003240] unsupported marker 0x97C8 at pos 0x6F0
> [jpeg2000 @ 0x7fb0b8003240] Missing EOC Marker.
> [jpeg2000 @ 0x7fb0b8032280] unsupported marker 0x97C8 at pos 0x6F0
> [jpeg2000 @ 0x7fb0b8032280] Missing EOC Marker.
> [jpeg2000 @ 0x7fb0b8006280] Psot 66195 too big
> [jpeg2000 @ 0x7fb0b8006280] error during processing marker segment
> ff90

Took a while to figure out, but this is due to buf_size - i - 9 being
changed to unsigned because of the uint32_t. Try attached patch. The
rest of the set should work with it.

Can we roll these tests into FATE?

/Tomas

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

From e6a35973456d132adc4ae87904dfb3c31eff0fd5 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..34a5487e90 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
+                int skip = FFMIN(FFMIN((int64_t)m->skip_bytes - 8, buf_size - i - 9), INT_MAX);
+                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

* Re: [FFmpeg-devel] [PATCH 1/8] libavcodec/jpeg2000_parser: Speed up long skips
  2022-06-02  9:54     ` Tomas Härdin
@ 2022-06-02 19:19       ` Michael Niedermayer
  2022-06-03  9:17         ` Tomas Härdin
  0 siblings, 1 reply; 24+ messages in thread
From: Michael Niedermayer @ 2022-06-02 19:19 UTC (permalink / raw)
  To: FFmpeg development discussions and patches


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

On Thu, Jun 02, 2022 at 11:54:39AM +0200, Tomas Härdin wrote:
> ons 2022-06-01 klockan 18:23 +0200 skrev Michael Niedermayer:
> > On Wed, Jun 01, 2022 at 06:21:19PM +0200, Michael Niedermayer wrote:
> > > On Tue, May 31, 2022 at 11:58:39AM +0200, Tomas Härdin wrote:
> > > > 
> > > 
> > > >  jpeg2000_parser.c |   11 +++++++++++
> > > >  1 file changed, 11 insertions(+)
> > > > 634546fb5a0eb281eea87ad7471c503f5bc9e8ab  0001-libavcodec-
> > > > jpeg2000_parser-Speed-up-long-skips.patch
> > > > 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(+)
> > > 
> > > breaks
> > > j2kref/codestreams_profile1/p1_04.j2k
> > 
> > [jpeg2000 @ 0x7fb0b8002600] Psot 66195 too big
> > [jpeg2000 @ 0x7fb0b8002600] error during processing marker segment
> > ff90
> > Input #0, j2k_pipe, from 'j2kref/codestreams_profile1/p1_04.j2k':
> >   Duration: N/A, bitrate: N/A
> >   Stream #0:0: Video: jpeg2000 (JPEG 2000 codestream restriction 1),
> > gray16le(12 bpc), 1024x1024, 25 fps, 25 tbr, 25 tbn
> > [jpeg2000 @ 0x7fb0b8003240] unsupported marker 0x97C8 at pos 0x6F0
> > [jpeg2000 @ 0x7fb0b8003240] Missing EOC Marker.
> > [jpeg2000 @ 0x7fb0b8032280] unsupported marker 0x97C8 at pos 0x6F0
> > [jpeg2000 @ 0x7fb0b8032280] Missing EOC Marker.
> > [jpeg2000 @ 0x7fb0b8006280] Psot 66195 too big
> > [jpeg2000 @ 0x7fb0b8006280] error during processing marker segment
> > ff90
> 
> Took a while to figure out, but this is due to buf_size - i - 9 being
> changed to unsigned because of the uint32_t. Try attached patch. The
> rest of the set should work with it.

works fine here


> 
> Can we roll these tests into FATE?

feel free to do so. 
ill test if someone posts a patch

thx

[...]

-- 
Michael     GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB

Those who are too smart to engage in politics are punished by being
governed by those who are dumber. -- 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] 24+ messages in thread

* Re: [FFmpeg-devel] [PATCH 1/8] libavcodec/jpeg2000_parser: Speed up long skips
  2022-06-02 19:19       ` Michael Niedermayer
@ 2022-06-03  9:17         ` Tomas Härdin
  2022-06-03 14:58           ` Michael Niedermayer
  0 siblings, 1 reply; 24+ messages in thread
From: Tomas Härdin @ 2022-06-03  9:17 UTC (permalink / raw)
  To: FFmpeg development discussions and patches

tor 2022-06-02 klockan 21:19 +0200 skrev Michael Niedermayer:
> On Thu, Jun 02, 2022 at 11:54:39AM +0200, Tomas Härdin wrote:
> > ons 2022-06-01 klockan 18:23 +0200 skrev Michael Niedermayer:
> > > On Wed, Jun 01, 2022 at 06:21:19PM +0200, Michael Niedermayer
> > > wrote:
> > > > On Tue, May 31, 2022 at 11:58:39AM +0200, Tomas Härdin wrote:
> > > > > 
> > > > 
> > > > >  jpeg2000_parser.c |   11 +++++++++++
> > > > >  1 file changed, 11 insertions(+)
> > > > > 634546fb5a0eb281eea87ad7471c503f5bc9e8ab  0001-libavcodec-
> > > > > jpeg2000_parser-Speed-up-long-skips.patch
> > > > > 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(+)
> > > > 
> > > > breaks
> > > > j2kref/codestreams_profile1/p1_04.j2k
> > > 
> > > [jpeg2000 @ 0x7fb0b8002600] Psot 66195 too big
> > > [jpeg2000 @ 0x7fb0b8002600] error during processing marker
> > > segment
> > > ff90
> > > Input #0, j2k_pipe, from 'j2kref/codestreams_profile1/p1_04.j2k':
> > >   Duration: N/A, bitrate: N/A
> > >   Stream #0:0: Video: jpeg2000 (JPEG 2000 codestream restriction
> > > 1),
> > > gray16le(12 bpc), 1024x1024, 25 fps, 25 tbr, 25 tbn
> > > [jpeg2000 @ 0x7fb0b8003240] unsupported marker 0x97C8 at pos
> > > 0x6F0
> > > [jpeg2000 @ 0x7fb0b8003240] Missing EOC Marker.
> > > [jpeg2000 @ 0x7fb0b8032280] unsupported marker 0x97C8 at pos
> > > 0x6F0
> > > [jpeg2000 @ 0x7fb0b8032280] Missing EOC Marker.
> > > [jpeg2000 @ 0x7fb0b8006280] Psot 66195 too big
> > > [jpeg2000 @ 0x7fb0b8006280] error during processing marker
> > > segment
> > > ff90
> > 
> > Took a while to figure out, but this is due to buf_size - i - 9
> > being
> > changed to unsigned because of the uint32_t. Try attached patch.
> > The
> > rest of the set should work with it.
> 
> works fine here

Great

> > Can we roll these tests into FATE?
> 
> feel free to do so. 
> ill test if someone posts a patch

How are you testing them? Just decoding and checking that the output is
the same as some reference output? Just looking for non-zero exit code?

/Tomas

_______________________________________________
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

* Re: [FFmpeg-devel] [PATCH 1/8] libavcodec/jpeg2000_parser: Speed up long skips
  2022-06-03  9:17         ` Tomas Härdin
@ 2022-06-03 14:58           ` Michael Niedermayer
  0 siblings, 0 replies; 24+ messages in thread
From: Michael Niedermayer @ 2022-06-03 14:58 UTC (permalink / raw)
  To: FFmpeg development discussions and patches


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

On Fri, Jun 03, 2022 at 11:17:54AM +0200, Tomas Härdin wrote:
> tor 2022-06-02 klockan 21:19 +0200 skrev Michael Niedermayer:
> > On Thu, Jun 02, 2022 at 11:54:39AM +0200, Tomas Härdin wrote:
> > > ons 2022-06-01 klockan 18:23 +0200 skrev Michael Niedermayer:
> > > > On Wed, Jun 01, 2022 at 06:21:19PM +0200, Michael Niedermayer
> > > > wrote:
> > > > > On Tue, May 31, 2022 at 11:58:39AM +0200, Tomas Härdin wrote:
> > > > > > 
> > > > > 
> > > > > >  jpeg2000_parser.c |   11 +++++++++++
> > > > > >  1 file changed, 11 insertions(+)
> > > > > > 634546fb5a0eb281eea87ad7471c503f5bc9e8ab  0001-libavcodec-
> > > > > > jpeg2000_parser-Speed-up-long-skips.patch
> > > > > > 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(+)
> > > > > 
> > > > > breaks
> > > > > j2kref/codestreams_profile1/p1_04.j2k
> > > > 
> > > > [jpeg2000 @ 0x7fb0b8002600] Psot 66195 too big
> > > > [jpeg2000 @ 0x7fb0b8002600] error during processing marker
> > > > segment
> > > > ff90
> > > > Input #0, j2k_pipe, from 'j2kref/codestreams_profile1/p1_04.j2k':
> > > >   Duration: N/A, bitrate: N/A
> > > >   Stream #0:0: Video: jpeg2000 (JPEG 2000 codestream restriction
> > > > 1),
> > > > gray16le(12 bpc), 1024x1024, 25 fps, 25 tbr, 25 tbn
> > > > [jpeg2000 @ 0x7fb0b8003240] unsupported marker 0x97C8 at pos
> > > > 0x6F0
> > > > [jpeg2000 @ 0x7fb0b8003240] Missing EOC Marker.
> > > > [jpeg2000 @ 0x7fb0b8032280] unsupported marker 0x97C8 at pos
> > > > 0x6F0
> > > > [jpeg2000 @ 0x7fb0b8032280] Missing EOC Marker.
> > > > [jpeg2000 @ 0x7fb0b8006280] Psot 66195 too big
> > > > [jpeg2000 @ 0x7fb0b8006280] error during processing marker
> > > > segment
> > > > ff90
> > > 
> > > Took a while to figure out, but this is due to buf_size - i - 9
> > > being
> > > changed to unsigned because of the uint32_t. Try attached patch.
> > > The
> > > rest of the set should work with it.
> > 
> > works fine here
> 
> Great
> 
> > > Can we roll these tests into FATE?
> > 
> > feel free to do so. 
> > ill test if someone posts a patch
> 
> How are you testing them? Just decoding and checking that the output is
> the same as some reference output? 

yes


> Just looking for non-zero exit code?

[...]
-- 
Michael     GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB

Any man who breaks a law that conscience tells him is unjust and willingly 
accepts the penalty by staying in jail in order to arouse the conscience of 
the community on the injustice of the law is at that moment expressing the 
very highest respect for law. - Martin Luther King Jr

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

* Re: [FFmpeg-devel] [PATCH 1/8] libavcodec/jpeg2000_parser: Speed up long skips
  2022-05-31  9:58 [FFmpeg-devel] [PATCH 1/8] libavcodec/jpeg2000_parser: Speed up long skips Tomas Härdin
                   ` (8 preceding siblings ...)
  2022-06-01 16:21 ` Michael Niedermayer
@ 2022-06-10  9:12 ` Tomas Härdin
  9 siblings, 0 replies; 24+ messages in thread
From: Tomas Härdin @ 2022-06-10  9:12 UTC (permalink / raw)
  To: FFmpeg development discussions and patches

Pushed all except patch 8/8 because I'm working on something better

/Tomas

_______________________________________________
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