From 68add7a3abb85d84e484ae58b1661d7bbf66c04d Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Tomas=20H=C3=A4rdin?= <g...@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

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

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

Reply via email to