]> git.sesse.net Git - ffmpeg/commitdiff
avcodec/exr: add fast path for case when powf() isn't needed
authorPaul B Mahol <onemda@gmail.com>
Sun, 28 Feb 2021 22:14:40 +0000 (23:14 +0100)
committerPaul B Mahol <onemda@gmail.com>
Sun, 28 Feb 2021 22:19:01 +0000 (23:19 +0100)
libavcodec/exr.c

index 4559174ba261316eed26673f1c9f7d51703e6418..640807cea9985feef6f301f513530796dafcc22b 100644 (file)
@@ -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