[FFmpeg-cvslog] dv: Merge dvquant.h into dvdata.c where all other DV tables reside.

Diego Biurrun git at videolan.org
Tue Apr 17 12:27:18 CEST 2012


ffmpeg | branch: master | Diego Biurrun <diego at biurrun.de> | Wed Apr  4 17:32:55 2012 +0200| [a3dbd459ffe1eef2705090d33e3bdaac539bb62f] | committer: Diego Biurrun

dv: Merge dvquant.h into dvdata.c where all other DV tables reside.

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

 libavcodec/dv.c      |   17 +++----
 libavcodec/dvdata.c  |   93 +++++++++++++++++++++++++++++++++++++
 libavcodec/dvdata.h  |   10 ++++
 libavcodec/dvdec.c   |    3 +-
 libavcodec/dvquant.h |  125 --------------------------------------------------
 5 files changed, 112 insertions(+), 136 deletions(-)

diff --git a/libavcodec/dv.c b/libavcodec/dv.c
index 86ff211..034daac 100644
--- a/libavcodec/dv.c
+++ b/libavcodec/dv.c
@@ -46,7 +46,6 @@
 #include "put_bits.h"
 #include "simple_idct.h"
 #include "dvdata.h"
-#include "dvquant.h"
 #include "dv_tablegen.h"
 
 /* XXX: also include quantization */
@@ -204,11 +203,11 @@ int ff_dv_init_dynamic_tables(const DVprofile *d)
         factor1 = &d->idct_factor[0];
         factor2 = &d->idct_factor[DV_PROFILE_IS_HD(d)?4096:2816];
         if (d->height == 720) {
-            iweight1 = &dv_iweight_720_y[0];
-            iweight2 = &dv_iweight_720_c[0];
+            iweight1 = &ff_dv_iweight_720_y[0];
+            iweight2 = &ff_dv_iweight_720_c[0];
         } else {
-            iweight1 = &dv_iweight_1080_y[0];
-            iweight2 = &dv_iweight_1080_c[0];
+            iweight1 = &ff_dv_iweight_1080_y[0];
+            iweight2 = &ff_dv_iweight_1080_c[0];
         }
         if (DV_PROFILE_IS_HD(d)) {
             for (c = 0; c < 4; c++) {
@@ -220,12 +219,12 @@ int ff_dv_init_dynamic_tables(const DVprofile *d)
                 }
             }
         } else {
-            iweight1 = &dv_iweight_88[0];
-            for (j = 0; j < 2; j++, iweight1 = &dv_iweight_248[0]) {
+            iweight1 = &ff_dv_iweight_88[0];
+            for (j = 0; j < 2; j++, iweight1 = &ff_dv_iweight_248[0]) {
                 for (s = 0; s < 22; s++) {
                     for (i = c = 0; c < 4; c++) {
                         for (; i < dv_quant_areas[c]; i++) {
-                            *factor1   = iweight1[i] << (dv_quant_shifts[s][c] + 1);
+                            *factor1   = iweight1[i] << (ff_dv_quant_shifts[s][c] + 1);
                             *factor2++ = (*factor1++) << 1;
                         }
                     }
@@ -609,7 +608,7 @@ static inline void dv_guess_qnos(EncBlockInfo* blks, int* qnos)
           size[i] = 0;
           for (j = 0; j < 6; j++, b++) {
              for (a = 0; a < 4; a++) {
-                if (b->area_q[a] != dv_quant_shifts[qnos[i] + dv_quant_offset[b->cno]][a]) {
+                if (b->area_q[a] != ff_dv_quant_shifts[qnos[i] + ff_dv_quant_offset[b->cno]][a]) {
                     b->bit_size[a] = 1; // 4 areas 4 bits for EOB :)
                     b->area_q[a]++;
                     prev = b->prev[a];
diff --git a/libavcodec/dvdata.c b/libavcodec/dvdata.c
index 6d123a9..353ecd5 100644
--- a/libavcodec/dvdata.c
+++ b/libavcodec/dvdata.c
@@ -29,6 +29,99 @@
 #include "avcodec.h"
 #include "dvdata.h"
 
+/* unquant tables (not used directly) */
+const uint8_t ff_dv_quant_shifts[22][4] = {
+  { 3,3,4,4 },
+  { 3,3,4,4 },
+  { 2,3,3,4 },
+  { 2,3,3,4 },
+  { 2,2,3,3 },
+  { 2,2,3,3 },
+  { 1,2,2,3 },
+  { 1,2,2,3 },
+  { 1,1,2,2 },
+  { 1,1,2,2 },
+  { 0,1,1,2 },
+  { 0,1,1,2 },
+  { 0,0,1,1 },
+  { 0,0,1,1 },
+  { 0,0,0,1 },
+  { 0,0,0,0 },
+  { 0,0,0,0 },
+  { 0,0,0,0 },
+  { 0,0,0,0 },
+  { 0,0,0,0 },
+  { 0,0,0,0 },
+  { 0,0,0,0 },
+};
+
+const uint8_t ff_dv_quant_offset[4] = { 6,  3,  0,  1 };
+
+const int ff_dv_iweight_88[64] = {
+ 32768, 16710, 16710, 17735, 17015, 17735, 18197, 18079,
+ 18079, 18197, 18725, 18559, 19196, 18559, 18725, 19284,
+ 19108, 19692, 19692, 19108, 19284, 21400, 19645, 20262,
+ 20214, 20262, 19645, 21400, 22733, 21845, 20867, 20815,
+ 20815, 20867, 21845, 22733, 23173, 23173, 21400, 21400,
+ 21400, 23173, 23173, 24600, 23764, 22017, 22017, 23764,
+ 24600, 25267, 24457, 22672, 24457, 25267, 25971, 25191,
+ 25191, 25971, 26715, 27962, 26715, 29642, 29642, 31536,
+};
+const int ff_dv_iweight_248[64] = {
+ 32768, 17735, 16710, 18079, 18725, 21400, 17735, 19196,
+ 19108, 21845, 16384, 17735, 18725, 21400, 16710, 18079,
+ 20262, 23173, 18197, 19692, 18725, 20262, 20815, 23764,
+ 17735, 19196, 19108, 21845, 20262, 23173, 18197, 19692,
+ 21400, 24457, 19284, 20867, 21400, 23173, 22017, 25191,
+ 18725, 20262, 20815, 23764, 21400, 24457, 19284, 20867,
+ 24457, 27962, 22733, 24600, 25971, 29642, 21400, 23173,
+ 22017, 25191, 24457, 27962, 22733, 24600, 25971, 29642,
+};
+
+/**
+ * The "inverse" DV100 weights are actually just the spec weights (zig-zagged).
+ */
+const int ff_dv_iweight_1080_y[64] = {
+    128,  16,  16,  17,  17,  17,  18,  18,
+     18,  18,  18,  18,  19,  18,  18,  19,
+     19,  19,  19,  19,  19,  42,  38,  40,
+     40,  40,  38,  42,  44,  43,  41,  41,
+     41,  41,  43,  44,  45,  45,  42,  42,
+     42,  45,  45,  48,  46,  43,  43,  46,
+     48,  49,  48,  44,  48,  49, 101,  98,
+     98, 101, 104, 109, 104, 116, 116, 123,
+};
+const int ff_dv_iweight_1080_c[64] = {
+    128,  16,  16,  17,  17,  17,  25,  25,
+     25,  25,  26,  25,  26,  25,  26,  26,
+     26,  27,  27,  26,  26,  42,  38,  40,
+     40,  40,  38,  42,  44,  43,  41,  41,
+     41,  41,  43,  44,  91,  91,  84,  84,
+     84,  91,  91,  96,  93,  86,  86,  93,
+     96, 197, 191, 177, 191, 197, 203, 197,
+    197, 203, 209, 219, 209, 232, 232, 246,
+};
+const int ff_dv_iweight_720_y[64] = {
+    128,  16,  16,  17,  17,  17,  18,  18,
+     18,  18,  18,  18,  19,  18,  18,  19,
+     19,  19,  19,  19,  19,  42,  38,  40,
+     40,  40,  38,  42,  44,  43,  41,  41,
+     41,  41,  43,  44,  68,  68,  63,  63,
+     63,  68,  68,  96,  92,  86,  86,  92,
+     96,  98,  96,  88,  96,  98, 202, 196,
+    196, 202, 208, 218, 208, 232, 232, 246,
+};
+const int ff_dv_iweight_720_c[64] = {
+    128,  24,  24,  26,  26,  26,  36,  36,
+     36,  36,  36,  36,  38,  36,  36,  38,
+     38,  38,  38,  38,  38,  84,  76,  80,
+     80,  80,  76,  84,  88,  86,  82,  82,
+     82,  82,  86,  88, 182, 182, 168, 168,
+    168, 182, 182, 192, 186, 192, 172, 186,
+    192, 394, 382, 354, 382, 394, 406, 394,
+    394, 406, 418, 438, 418, 464, 464, 492,
+};
+
 static DVwork_chunk work_chunks_dv25pal   [1*12*27];
 static DVwork_chunk work_chunks_dv25pal411[1*12*27];
 static DVwork_chunk work_chunks_dv25ntsc  [1*10*27];
diff --git a/libavcodec/dvdata.h b/libavcodec/dvdata.h
index 8b4811a..54a4bf1 100644
--- a/libavcodec/dvdata.h
+++ b/libavcodec/dvdata.h
@@ -104,6 +104,16 @@ enum dv_pack_type {
      dv_unknown_pack  = 0xff,
 };
 
+extern const uint8_t ff_dv_quant_shifts[22][4];
+extern const uint8_t ff_dv_quant_offset[4];
+
+extern const int ff_dv_iweight_88[64];
+extern const int ff_dv_iweight_248[64];
+extern const int ff_dv_iweight_1080_y[64];
+extern const int ff_dv_iweight_1080_c[64];
+extern const int ff_dv_iweight_720_y[64];
+extern const int ff_dv_iweight_720_c[64];
+
 #define DV_PROFILE_IS_HD(p) ((p)->video_stype & 0x10)
 #define DV_PROFILE_IS_1080i50(p) (((p)->video_stype == 0x14) && ((p)->dsf == 1))
 #define DV_PROFILE_IS_720p50(p)  (((p)->video_stype == 0x18) && ((p)->dsf == 1))
diff --git a/libavcodec/dvdec.c b/libavcodec/dvdec.c
index 582574b..6b77a40 100644
--- a/libavcodec/dvdec.c
+++ b/libavcodec/dvdec.c
@@ -42,7 +42,6 @@
 #include "put_bits.h"
 #include "simple_idct.h"
 #include "dvdata.h"
-#include "dvquant.h"
 
 typedef struct BlockInfo {
     const uint32_t *factor_table;
@@ -183,7 +182,7 @@ static int dv_decode_video_segment(AVCodecContext *avctx, void *arg)
                 mb->idct_put     = s->idct_put[dct_mode && log2_blocksize == 3];
                 mb->scan_table   = s->dv_zigzag[dct_mode];
                 mb->factor_table = &s->sys->idct_factor[(class1 == 3)*2*22*64 + dct_mode*22*64 +
-                                                        (quant + dv_quant_offset[class1])*64];
+                                                        (quant + ff_dv_quant_offset[class1])*64];
             }
             dc = dc << 2;
             /* convert to unsigned because 128 is not added in the
diff --git a/libavcodec/dvquant.h b/libavcodec/dvquant.h
deleted file mode 100644
index feb778a..0000000
--- a/libavcodec/dvquant.h
+++ /dev/null
@@ -1,125 +0,0 @@
-/*
- * Quant and Weight for DV codec
- * Copyright (c) 2002 Fabrice Bellard
- *
- * This file is part of Libav.
- *
- * Libav is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 2.1 of the License, or (at your option) any later version.
- *
- * Libav is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with Libav; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- */
-
-/**
- * @file
- * Constants for DV codec.
- */
-
-#ifndef AVCODEC_DVQUANT_H
-#define AVCODEC_DVQUANT_H
-
-#include <stdint.h>
-
-/* unquant tables (not used directly) */
-static const uint8_t dv_quant_shifts[22][4] = {
-  { 3,3,4,4 },
-  { 3,3,4,4 },
-  { 2,3,3,4 },
-  { 2,3,3,4 },
-  { 2,2,3,3 },
-  { 2,2,3,3 },
-  { 1,2,2,3 },
-  { 1,2,2,3 },
-  { 1,1,2,2 },
-  { 1,1,2,2 },
-  { 0,1,1,2 },
-  { 0,1,1,2 },
-  { 0,0,1,1 },
-  { 0,0,1,1 },
-  { 0,0,0,1 },
-  { 0,0,0,0 },
-  { 0,0,0,0 },
-  { 0,0,0,0 },
-  { 0,0,0,0 },
-  { 0,0,0,0 },
-  { 0,0,0,0 },
-  { 0,0,0,0 },
-};
-
-static const uint8_t dv_quant_offset[4] = { 6,  3,  0,  1 };
-
-static const int dv_iweight_88[64] = {
- 32768, 16710, 16710, 17735, 17015, 17735, 18197, 18079,
- 18079, 18197, 18725, 18559, 19196, 18559, 18725, 19284,
- 19108, 19692, 19692, 19108, 19284, 21400, 19645, 20262,
- 20214, 20262, 19645, 21400, 22733, 21845, 20867, 20815,
- 20815, 20867, 21845, 22733, 23173, 23173, 21400, 21400,
- 21400, 23173, 23173, 24600, 23764, 22017, 22017, 23764,
- 24600, 25267, 24457, 22672, 24457, 25267, 25971, 25191,
- 25191, 25971, 26715, 27962, 26715, 29642, 29642, 31536,
-};
-static const int dv_iweight_248[64] = {
- 32768, 17735, 16710, 18079, 18725, 21400, 17735, 19196,
- 19108, 21845, 16384, 17735, 18725, 21400, 16710, 18079,
- 20262, 23173, 18197, 19692, 18725, 20262, 20815, 23764,
- 17735, 19196, 19108, 21845, 20262, 23173, 18197, 19692,
- 21400, 24457, 19284, 20867, 21400, 23173, 22017, 25191,
- 18725, 20262, 20815, 23764, 21400, 24457, 19284, 20867,
- 24457, 27962, 22733, 24600, 25971, 29642, 21400, 23173,
- 22017, 25191, 24457, 27962, 22733, 24600, 25971, 29642,
-};
-
-/**
- * The "inverse" DV100 weights are actually just the spec weights (zig-zagged).
- */
-static const int dv_iweight_1080_y[64] = {
-    128,  16,  16,  17,  17,  17,  18,  18,
-     18,  18,  18,  18,  19,  18,  18,  19,
-     19,  19,  19,  19,  19,  42,  38,  40,
-     40,  40,  38,  42,  44,  43,  41,  41,
-     41,  41,  43,  44,  45,  45,  42,  42,
-     42,  45,  45,  48,  46,  43,  43,  46,
-     48,  49,  48,  44,  48,  49, 101,  98,
-     98, 101, 104, 109, 104, 116, 116, 123,
-};
-static const int dv_iweight_1080_c[64] = {
-    128,  16,  16,  17,  17,  17,  25,  25,
-     25,  25,  26,  25,  26,  25,  26,  26,
-     26,  27,  27,  26,  26,  42,  38,  40,
-     40,  40,  38,  42,  44,  43,  41,  41,
-     41,  41,  43,  44,  91,  91,  84,  84,
-     84,  91,  91,  96,  93,  86,  86,  93,
-     96, 197, 191, 177, 191, 197, 203, 197,
-    197, 203, 209, 219, 209, 232, 232, 246,
-};
-static const int dv_iweight_720_y[64] = {
-    128,  16,  16,  17,  17,  17,  18,  18,
-     18,  18,  18,  18,  19,  18,  18,  19,
-     19,  19,  19,  19,  19,  42,  38,  40,
-     40,  40,  38,  42,  44,  43,  41,  41,
-     41,  41,  43,  44,  68,  68,  63,  63,
-     63,  68,  68,  96,  92,  86,  86,  92,
-     96,  98,  96,  88,  96,  98, 202, 196,
-    196, 202, 208, 218, 208, 232, 232, 246,
-};
-static const int dv_iweight_720_c[64] = {
-    128,  24,  24,  26,  26,  26,  36,  36,
-     36,  36,  36,  36,  38,  36,  36,  38,
-     38,  38,  38,  38,  38,  84,  76,  80,
-     80,  80,  76,  84,  88,  86,  82,  82,
-     82,  82,  86,  88, 182, 182, 168, 168,
-    168, 182, 182, 192, 186, 192, 172, 186,
-    192, 394, 382, 354, 382, 394, 406, 394,
-    394, 406, 418, 438, 418, 464, 464, 492,
-};
-
-#endif /* AVCODEC_DVQUANT_H */



More information about the ffmpeg-cvslog mailing list