[FFmpeg-cvslog] avcodec/exr: add fast path for case when powf() isn't needed

Paul B Mahol git at videolan.org
Mon Mar 1 00:19:24 EET 2021


ffmpeg | branch: master | Paul B Mahol <onemda at gmail.com> | Sun Feb 28 23:14:40 2021 +0100| [4cb989e83631c801718723ad95367fdd561e0ae0] | committer: Paul B Mahol

avcodec/exr: add fast path for case when powf() isn't needed

> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=4cb989e83631c801718723ad95367fdd561e0ae0
---

 libavcodec/exr.c | 7 ++++++-
 1 file changed, 6 insertions(+), 1 deletion(-)

diff --git a/libavcodec/exr.c b/libavcodec/exr.c
index 4559174ba2..640807cea9 100644
--- a/libavcodec/exr.c
+++ b/libavcodec/exr.c
@@ -1130,13 +1130,18 @@ static int decode_block(AVCodecContext *avctx, void *tdata,
                             t.f = trc_func(t.f);
                             *ptr_x++ = t;
                         }
-                    } else {
+                    } else if (one_gamma != 1.f) {
                         for (x = 0; x < xsize; x++) {
                             t.i = bytestream_get_le32(&src);
                             if (t.f > 0.0f && c < 3)  /* avoid negative values */
                                 t.f = powf(t.f, one_gamma);
                             *ptr_x++ = t;
                         }
+                    } else {
+                        for (x = 0; x < xsize; x++) {
+                            t.i = bytestream_get_le32(&src);
+                            *ptr_x++ = t;
+                        }
                     }
                 } else if (s->pixel_type == EXR_HALF) {
                     // 16-bit



More information about the ffmpeg-cvslog mailing list