summaryrefslogtreecommitdiff
path: root/libavcodec/mathops.h
diff options
context:
space:
mode:
authorMartijn van Beurden <mvanb1@gmail.com>2022-10-11 19:24:35 +0200
committerPaul B Mahol <onemda@gmail.com>2022-12-26 21:15:36 +0100
commit909cfdc2059a53ffb55af3b9e0aadcaacae4a339 (patch)
tree274d6543dd851195daa27f7536978d27f97710df /libavcodec/mathops.h
parenteeb280f3518a8d7fc2e45f06ac7748f42d8a0000 (diff)
downloadffmpeg-909cfdc2059a53ffb55af3b9e0aadcaacae4a339.tar.gz
libavcodec/flacdec: Implement decoding of 32 bit-per-sample PCM
Add decoding of FLAC files coding for 32 bit-per-sample PCM to libavcodec.
Diffstat (limited to 'libavcodec/mathops.h')
-rw-r--r--libavcodec/mathops.h9
1 files changed, 9 insertions, 0 deletions
diff --git a/libavcodec/mathops.h b/libavcodec/mathops.h
index c89054d6ed..a1dc323304 100644
--- a/libavcodec/mathops.h
+++ b/libavcodec/mathops.h
@@ -138,6 +138,15 @@ static inline av_const int sign_extend(int val, unsigned bits)
}
#endif
+#ifndef sign_extend64
+static inline av_const int64_t sign_extend64(int64_t val, unsigned bits)
+{
+ unsigned shift = 8 * sizeof(int64_t) - bits;
+ union { uint64_t u; int64_t s; } v = { (uint64_t) val << shift };
+ return v.s >> shift;
+}
+#endif
+
#ifndef zero_extend
static inline av_const unsigned zero_extend(unsigned val, unsigned bits)
{