[FFmpeg-cvslog] diracdec: Support new extended quantiser range

Kieran Kunhya git at videolan.org
Thu Dec 10 22:38:07 CET 2015


ffmpeg | branch: master | Kieran Kunhya <kierank at ob-encoder.com> | Wed Dec  9 00:05:34 2015 +0000| [8eb6acef928d1d5f1a09e2ecb598ace2c99878f1] | committer: Rostislav Pehlivanov

diracdec: Support new extended quantiser range

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

 libavcodec/diracdec.c |   58 +++++++++++++++++++++++++++++++------------------
 1 file changed, 37 insertions(+), 21 deletions(-)

diff --git a/libavcodec/diracdec.c b/libavcodec/diracdec.c
index 83547eb..f2d4a42 100644
--- a/libavcodec/diracdec.c
+++ b/libavcodec/diracdec.c
@@ -57,7 +57,7 @@
 #define MAX_REFERENCE_FRAMES 8
 #define MAX_DELAY 5         /* limit for main profile for frame coding (TODO: field coding) */
 #define MAX_FRAMES (MAX_REFERENCE_FRAMES + MAX_DELAY + 1)
-#define MAX_QUANT 68        /* max quant for VC-2 */
+#define MAX_QUANT 255        /* max quant for VC-2 */
 #define MAX_BLOCKSIZE 32    /* maximum xblen/yblen we support */
 
 /**
@@ -255,26 +255,42 @@ static const uint8_t default_qmat[][4][4] = {
     { { 3,  1,  1,  0}, { 0,  4,  4,  2}, { 0,  6,  6,  5}, { 0,  9,  9,  7} },
 };
 
-static const int qscale_tab[MAX_QUANT+1] = {
-    4,     5,     6,     7,     8,    10,    11,    13,
-    16,    19,    23,    27,    32,    38,    45,    54,
-    64,    76,    91,   108,   128,   152,   181,   215,
-    256,   304,   362,   431,   512,   609,   724,   861,
-    1024,  1218,  1448,  1722,  2048,  2435,  2896,  3444,
-    4096,  4871,  5793,  6889,  8192,  9742, 11585, 13777,
-    16384, 19484, 23170, 27554, 32768, 38968, 46341, 55109,
-    65536, 77936
+static const int32_t qscale_tab[128] = {
+        4,         5,         6,         7,          8,        10,        11,        13,
+       16,        19,        23,        27,         32,        38,        45,        54,
+       64,        76,        91,       108,        128,       152,       181,       215,
+      256,       304,       362,       431,        512,       609,       724,       861,
+     1024,      1218,      1448,      1722,       2048,      2435,      2896,      3444,
+     4096,      4871,      5793,      6889,       8192,      9742,     11585,     13777,
+    16384,     19484,    -13317,     27554,      32768,     -1581,      9853,    -10518,
+    65536,     -3164,    -16782,    -21037,     131072,     -6328,      2922,     23552,
+   262144,    -12658,      5844,    -18524,     524288,     15232,     11689,     28578,
+  1048576,    -10085,    -13110,     -8471,    2097152,    -20170,     10267,    -16943,
+  4194304,       208,    -15954,     31741,    8388608,       416,      4579,     -2146,
+ 16777216,       832,      9158,     -4293,   33554432,      1663,    -18172,     -8587,
+ 67108864,      3326,       143,    -17175,   134217728,     6653,       285,     31276,
+268435456,     13306,       570,     -3075,   536870912,   -13938,      1140,     -6152,
+1073741824,    12672,      2281,    -12304, -2147483648,   -15205,      4561,    -24610,
+         0,    10138,      9122,     16407,           0,   -20274,    -18243,    -32813,
 };
 
-static const int qoffset_intra_tab[MAX_QUANT+1] = {
-    1,     2,     3,     4,     4,     5,     6,     7,
-    8,    10,    12,    14,    16,    19,    23,    27,
-    32,    38,    46,    54,    64,    76,    91,   108,
-    128,   152,   181,   216,   256,   305,   362,   431,
-    512,   609,   724,   861,  1024,  1218,  1448,  1722,
-    2048,  2436,  2897,  3445,  4096,  4871,  5793,  6889,
-    8192,  9742, 11585, 13777, 16384, 19484, 23171, 27555,
-    32768, 38968
+static const int32_t qoffset_intra_tab[128] = {
+        1,         2,         3,         4,         4,         5,         6,         7,
+        8,        10,        12,        14,          16,        19,        23,        27,
+       32,        38,        46,        54,          64,        76,        91,       108,
+      128,       152,       181,       216,         256,       305,       362,       431,
+      512,       609,       724,       861,        1024,      1218,      1448,      1722,
+     2048,      2436,      2897,      3445,        4096,      4871,      5793,      6889,
+     8192,      9742,     -6658,     13777,       16384,      -790,      4927,     -5258,
+    32768,     -1581,     -8390,    -10518,       65536,     -3163,      1461,     11776,
+   131072,     -6328,      2922,     -9261,      262144,      7616,      5845,     14289,
+   524288,     -5042,     -6554,     -4235,     1048576,    -10084,      5134,     -8471,
+  2097152,       104,     -7976,     15871,     4194304,       208,      2290,     -1072,
+  8388608,       416,      4579,     -2146,    16777216,       832,     -9085,     -4293,
+ 33554432,      1663,        72,     -8587,    67108864,      3327,       143,     15638,
+134217728,      6653,       285,     -1537,   268435456,     -6968,       570,     -3075,
+536870912,      6336,      1141,     -6151, -1073741823,     -7602,      2281,    -12304,
+        0,      5069,      4561,      8204,           0,    -10136,     -9121,    -16406,
 };
 
 static const int qoffset_inter_tab[MAX_QUANT+1] = {
@@ -730,8 +746,8 @@ static void decode_subband(DiracContext *s, GetBitContext *gb, int quant,
     int top    = b1->height * slice_y    / s->num_y;
     int bottom = b1->height *(slice_y+1) / s->num_y;
 
-    int qfactor = qscale_tab[FFMIN(quant, MAX_QUANT)];
-    int qoffset = qoffset_intra_tab[FFMIN(quant, MAX_QUANT)];
+    int qfactor = qscale_tab[quant & 0x7f];
+    int qoffset = qoffset_intra_tab[quant & 0x7f];
 
     uint8_t *buf1 =      b1->ibuf + top * b1->stride;
     uint8_t *buf2 = b2 ? b2->ibuf + top * b2->stride: NULL;



More information about the ffmpeg-cvslog mailing list