]> git.sesse.net Git - ffmpeg/blobdiff - libavcodec/g729data.h
h264: reject unsupported 422 9 bit streams
[ffmpeg] / libavcodec / g729data.h
index f0a09ab14cc1d4d4659d0473f75dc92cb6ee4f02..365ca47ec6da3b9dbe6f3686208d6e2d0a07d9a4 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * data for G.729 decoder
+ * data for G.729, G729 Annex D decoders
  * Copyright (c) 2007 Vladimir Voroshilov
  *
  * This file is part of FFmpeg.
@@ -245,6 +245,36 @@ static const int16_t cb_gain_2nd_8k[1<<GC_2ND_IDX_BITS_8K][2] = { /*(1.14) (1.13
   { 13260 ,  3256 },
 };
 
+/**
+ * gain codebook (first stage), 6.4k mode (D.3.9.2 of G.729)
+ */
+static const int16_t cb_gain_1st_6k4[1<<GC_1ST_IDX_BITS_6K4][2] =
+{ /*(0.14) (1.14)*/
+ { 5849,     0 },
+ { 3171,  9280 },
+ { 3617,  6747 },
+ { 4987, 22294 },
+ { 2929,  1078 },
+ { 6068,  6093 },
+ { 9425,  2731 },
+ { 3915, 12872 },
+};
+
+/**
+ * gain codebook (second stage), 6.4k mode (D.3.9.2 of G.729)
+ */
+static const int16_t cb_gain_2nd_6k4[1<<GC_2ND_IDX_BITS_6K4][2] =
+{ /*(1.14) (1.14)*/
+ {    0,  4175 },
+ {10828, 27602 },
+ {16423, 15724 },
+ { 4478,  7324 },
+ { 3988,     0 },
+ {10291, 11385 },
+ {11956, 10735 },
+ { 7876,  7821 },
+};
+
 /**
  * 4th order Moving Average (MA) Predictor codebook (3.2.4 of G.729)
  *
@@ -307,6 +337,13 @@ static const int16_t cb_ma_predictor_sum_inv[2][10] = { /* (3.12) */
   { 9202,  7320,  6788,  7738,  8170,  8154,  8856,  8818,  8366,  8544}
 };
 
+/**
+ * MA prediction coefficients (3.9.1 of G.729, near Equation 69)
+ */
+static const uint16_t ma_prediction_coeff[4] = { /* (0.13) */
+  5571, 4751, 2785, 1556
+};
+
 /**
  * initial LSP coefficients belongs to virtual frame preceding  the
  * first frame of the stream
@@ -314,4 +351,32 @@ static const int16_t cb_ma_predictor_sum_inv[2][10] = { /* (3.12) */
 static const int16_t lsp_init[10]= { /* (0.15) */
    30000, 26000, 21000, 15000, 8000, 0, -8000,-15000,-21000,-26000
 };
+
+/**
+ * additional "phase" post-processing filter impulse response (D.6.2 of G.729)
+ *
+ * Table contains three impulse responses, correspond to
+ * different amounts of spreading.
+ */
+static const int16_t phase_filter[3][40] =
+{
+  { // maximum spreading (for noise-like segments)
+    14690, 11518,  1268, -2762, -5672,  7514,  -36, -2808, -3041,  4823,
+     2952, -8425,  3785,  1455,  2179, -8638, 8051, -2104, -1455,   777,
+     1108, -2386,  2254,  -364,  -675, -2104, 6046, -5682,  1072,  3123,
+    -5059,  5312, -2330, -3729,  6924, -3890,  675, -1776,    29, 10145,
+  },
+  { // medium spreading
+    30274,  3831, -4037,  2972, -1049, -1003,  2477, -3044,  2815, -2232,
+     1753, -1612,  1714, -1776,  1543, -1009,   429,  -170,   472, -1265,
+     2176, -2707,  2523, -1622,   344,   826, -1530,  1724, -1658,  1701,
+    -2064,  2644, -3061,  2897, -1979,   557,   780, -1370,   842,   655,
+  },
+  { // no spreading (for voiced speech)
+    32767, 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, 0,
+        0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+  }
+};
 #endif /* AVCODEC_G729DATA_H */