[FFmpeg-cvslog] avcodec/proresdec : make inline func for unpack alpha

Martin Vignali git at videolan.org
Sun Dec 2 13:58:11 EET 2018


ffmpeg | branch: master | Martin Vignali <martin.vignali at gmail.com> | Sat Nov 17 23:37:00 2018 +0100| [859604fe9d680fbd1abc4b78a528909904874d95] | committer: Martin Vignali

avcodec/proresdec : make inline func for unpack alpha

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

 libavcodec/proresdec2.c | 16 ++++++++++++----
 1 file changed, 12 insertions(+), 4 deletions(-)

diff --git a/libavcodec/proresdec2.c b/libavcodec/proresdec2.c
index 94323df128..40d15720ba 100644
--- a/libavcodec/proresdec2.c
+++ b/libavcodec/proresdec2.c
@@ -46,9 +46,8 @@ static void permute(uint8_t *dst, const uint8_t *src, const uint8_t permutation[
         dst[i] = permutation[src[i]];
 }
 
-static void unpack_alpha_10(GetBitContext *gb, uint16_t *dst, int num_coeffs,
-                            const int num_bits)
-{
+static void inline unpack_alpha(GetBitContext *gb, uint16_t *dst, int num_coeffs,
+                                const int num_bits, const int decode_precision) {
     const int mask = (1 << num_bits) - 1;
     int i, idx, val, alpha_val;
 
@@ -86,11 +85,20 @@ static void unpack_alpha_10(GetBitContext *gb, uint16_t *dst, int num_coeffs,
         } else {
             for (i = 0; i < val; i++)
                 dst[idx++] = (alpha_val << 2) | (alpha_val >> 6);
-
         }
     } while (idx < num_coeffs);
 }
 
+static void unpack_alpha_10(GetBitContext *gb, uint16_t *dst, int num_coeffs,
+                            const int num_bits)
+{
+    if (num_bits == 16) {
+        unpack_alpha(gb, dst, num_coeffs, 16, 10);
+    } else { /* 8 bits alpha */
+        unpack_alpha(gb, dst, num_coeffs, 8, 10);
+    }
+}
+
 static av_cold int decode_init(AVCodecContext *avctx)
 {
     int ret = 0;



More information about the ffmpeg-cvslog mailing list