[FFmpeg-devel] [GSOC][PATCH] lavc/cfhd:corrected decompanding for table 9 used in cfhd
Gagandeep Singh
deepgagan231197 at gmail.com
Mon Aug 13 22:28:43 EEST 2018
---
libavcodec/cfhd.c | 25 ++++++++++++++++++++++++-
1 file changed, 24 insertions(+), 1 deletion(-)
diff --git a/libavcodec/cfhd.c b/libavcodec/cfhd.c
index 3906d7a86d..2c538f0bbd 100644
--- a/libavcodec/cfhd.c
+++ b/libavcodec/cfhd.c
@@ -114,7 +114,30 @@ static inline int dequant_and_decompand(int level, int quantisation, int codeboo
{
if (lossless)
return level;
- if (codebook == 0 || codebook == 1) {
+ if (codebook == 0) {
+ if (level >= 40 && level < 264) {
+ if (level >= 54) {
+ level -= 54;
+ level <<= 2;
+ level += 54;
+ }
+ level -= 40;
+ level <<= 2;
+ level += 40;
+ } else if (level <= -40) {
+ level = -level;
+ if (level >= 54) {
+ level -= 54;
+ level <<= 2;
+ level += 54;
+ }
+ level -= 40;
+ level <<= 2;
+ level += 40;
+ level = -level;
+ }
+ return level * quantisation;
+ } else if (codebook == 1) {
int64_t abslevel = abs(level);
if (level < 264)
return (abslevel + ((768 * abslevel * abslevel * abslevel) / (255 * 255 * 255))) *
--
2.17.1
More information about the ffmpeg-devel
mailing list