[FFmpeg-devel] [PATCH] lavc/cfhd: added correct decompanding to codebook0
Gagandeep Singh
deepgagan231197 at gmail.com
Thu Jun 21 13:33:10 EEST 2018
output of samples using codebook 0 improved
---
libavcodec/cfhd.c | 25 ++++++++++++++++++++++++-
1 file changed, 24 insertions(+), 1 deletion(-)
diff --git a/libavcodec/cfhd.c b/libavcodec/cfhd.c
index bf80cb9c07..226b135c07 100644
--- a/libavcodec/cfhd.c
+++ b/libavcodec/cfhd.c
@@ -115,7 +115,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.14.1
More information about the ffmpeg-devel
mailing list