This patch is more informal, there's probably a better way to bump
performance up above 50 fps. This is for the smoke_sauna sample on
SVT's FTP by the way.
From 103c38adabae39a607049ef517de43f4d2f9d406 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Tomas=20H=C3=A4rdin?= <g...@haerdin.se>
Date: Tue, 14 Jun 2022 11:19:06 +0200
Subject: [PATCH 10/11] lavc/jpeg2000dec: Use coarser slicing for initial
 reslevels

This brings -lowres 2 lossless 4K J2K on an AMD EPYC 7R32 to 52 fps (2080% CPU).
---
 libavcodec/jpeg2000dec.c | 10 ++++++++++
 1 file changed, 10 insertions(+)

diff --git a/libavcodec/jpeg2000dec.c b/libavcodec/jpeg2000dec.c
index 46f7d841b5..71176d944d 100644
--- a/libavcodec/jpeg2000dec.c
+++ b/libavcodec/jpeg2000dec.c
@@ -2673,9 +2673,19 @@ static int jpeg2000_decode_frame(AVCodecContext *avctx, AVFrame *picture,
 
     for (s->reslevel = 0; s->reslevel < maxreslevels; s->reslevel++) {
         for (s->dir = 0; s->dir < 2; s->dir++) {
+            int before = s->slices;
+            int div = s->slices >= 96 ? 7 : 5;
+
+            if (s->reslevel < div) {
+                int halve = 1<<(div - s->reslevel + (s->slices >= 96 ? 0 : 1 - s->dir));
+                s->slices = (s->slices + halve-1)/halve;
+            }
+
             if ((ret = avctx->execute2(avctx, jpeg2000_idwt, NULL, NULL,
                     s->numXtiles * s->numYtiles * s->ncomponents * s->slices)) < 0)
                 goto end;
+
+            s->slices = before;
         }
     }
 
-- 
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