-/**
- * VP8 compatible video decoder
- *
+/*
* Copyright (C) 2010 David Conrad
* Copyright (C) 2010 Ronald S. Bultje
*
- * This file is part of FFmpeg.
+ * This file is part of Libav.
*
- * FFmpeg is free software; you can redistribute it and/or
+ * 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.
*
- * FFmpeg is distributed in the hope that it will be useful,
+ * 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 FFmpeg; if not, write to the Free Software
+ * License along with Libav; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*/
-// TODO: move these #define ane enum to a better header...
-
-#define VP8_MAX_QUANT 127
-
-enum dct_token {
- DCT_0,
- DCT_1,
- DCT_2,
- DCT_3,
- DCT_4,
- DCT_CAT1,
- DCT_CAT2,
- DCT_CAT3,
- DCT_CAT4,
- DCT_CAT5,
- DCT_CAT6,
- DCT_EOB,
+/**
+ * @file
+ * VP8 compatible video decoder
+ */
- NUM_DCT_TOKENS
-};
+#ifndef AVCODEC_VP8DATA_H
+#define AVCODEC_VP8DATA_H
+#include "vp8.h"
#include "h264pred.h"
-// used to signal 4x4 intra pred in luma MBs
-#define MODE_I4x4 4
-
-enum inter_mvmode {
- VP8_MVMODE_NEAREST = MODE_I4x4 + 1,
- VP8_MVMODE_NEAR,
- VP8_MVMODE_ZERO,
- VP8_MVMODE_NEW,
- VP8_MVMODE_SPLIT
-};
-
-enum inter_submvmode {
- VP8_SUBMVMODE_LEFT4X4,
- VP8_SUBMVMODE_TOP4X4,
- VP8_SUBMVMODE_ZERO4X4,
- VP8_SUBMVMODE_NEW4X4
-};
-
static const uint8_t vp8_pred4x4_mode[] =
{
[DC_PRED8x8] = DC_PRED,
{ 234, 188, 128, 28 },
};
-static const int8_t vp8_pred16x16_tree_mvinter[4][2] = {
- { -VP8_MVMODE_ZERO, 1 }, // '0'
- { -VP8_MVMODE_NEAREST, 2 }, // '10'
- { -VP8_MVMODE_NEAR, 3 }, // '110'
- { -VP8_MVMODE_NEW, -VP8_MVMODE_SPLIT } // '1110', '1111'
-};
-
-static const int8_t vp8_small_mvtree[7][2] = {
- { 1, 4 },
- { 2, 3 },
- { -0, -1 }, // '000', '001'
- { -2, -3 }, // '010', '011'
- { 5, 6 },
- { -4, -5 }, // '100', '101'
- { -6, -7 } // '110', '111'
-};
-
-static const uint8_t vp8_mbsplits[4][16] = {
+static const uint8_t vp8_mbsplits[5][16] = {
{ 0, 0, 0, 0, 0, 0, 0, 0,
1, 1, 1, 1, 1, 1, 1, 1 },
{ 0, 0, 1, 1, 0, 0, 1, 1,
{ 0, 0, 1, 1, 0, 0, 1, 1,
2, 2, 3, 3, 2, 2, 3, 3 },
{ 0, 1, 2, 3, 4, 5, 6, 7,
- 8, 9, 10, 11, 12, 13, 14, 15 }
+ 8, 9, 10, 11, 12, 13, 14, 15 },
+ { 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0 }
};
static const uint8_t vp8_mbfirstidx[4][16] = {
8, 9, 10, 11, 12, 13, 14, 15 }
};
-static const int8_t vp8_mbsplit_tree[3][2] = {
- { -3, 1 }, // '0' - 16 individual MVs
- { -2, 2 }, // '10' - quarter-based MVs
- { -0, -1 } // '110' - top/bottom MVs,
- // '111' - left/right MVs
-};
static const uint8_t vp8_mbsplit_count[4] = { 2, 2, 4, 16 };
static const uint8_t vp8_mbsplit_prob[3] = { 110, 111, 150 };
{ 208, 1, 1 }
};
-static const int8_t vp8_submv_ref_tree[3][2] = {
- { -VP8_SUBMVMODE_LEFT4X4, 1 }, // '0'
- { -VP8_SUBMVMODE_TOP4X4, 2 }, // '10'
- { -VP8_SUBMVMODE_ZERO4X4, -VP8_SUBMVMODE_NEW4X4 } // '110', '111'
-};
-
static const uint8_t vp8_pred16x16_prob_intra[4] = { 145, 156, 163, 128 };
static const uint8_t vp8_pred16x16_prob_inter[4] = { 112, 86, 140, 37 };
0, 1, 2, 3, 6, 4, 5, 6, 6, 6, 6, 6, 6, 6, 6, 7
};
-static const int8_t vp8_coeff_tree[NUM_DCT_TOKENS-1][2] =
+/* Inverse of vp8_coeff_band: mappings of bands to coefficient indexes.
+ * Each list is -1-terminated. */
+static const int8_t vp8_coeff_band_indexes[8][10] =
{
- { -DCT_EOB, 1 }, // '0'
- { -DCT_0, 2 }, // '10'
- { -DCT_1, 3 }, // '110'
- { 4, 6 },
- { -DCT_2, 5 }, // '11100'
- { -DCT_3, -DCT_4 }, // '111010', '111011'
- { 7, 8 },
- { -DCT_CAT1, -DCT_CAT2 }, // '111100', '111101'
- { 9, 10 },
- { -DCT_CAT3, -DCT_CAT4 }, // '1111100', '1111101'
- { -DCT_CAT5, -DCT_CAT6 }, // '1111110', '1111111'
+ {0, -1},
+ {1, -1},
+ {2, -1},
+ {3, -1},
+ {5, -1},
+ {6, -1},
+ {4, 7, 8, 9, 10, 11, 12, 13, 14, -1},
+ {15, -1}
};
static const uint8_t vp8_dct_cat1_prob[] = { 159, 0 };
static const uint8_t vp8_dct_cat5_prob[] = { 180, 157, 141, 134, 130, 0 };
static const uint8_t vp8_dct_cat6_prob[] = { 254, 254, 243, 230, 196, 177, 153, 140, 133, 130, 129, 0 };
-static const uint8_t * const vp8_dct_cat_prob[6] =
+// only used for cat3 and above; cat 1 and 2 are referenced directly
+const uint8_t * const ff_vp8_dct_cat_prob[] =
{
- vp8_dct_cat1_prob,
- vp8_dct_cat2_prob,
vp8_dct_cat3_prob,
vp8_dct_cat4_prob,
vp8_dct_cat5_prob,
vp8_dct_cat6_prob,
};
-static const uint8_t vp8_dct_cat_offset[6] = { 5, 7, 11, 19, 35, 67 };
-
static const uint8_t vp8_token_default_probs[4][8][3][NUM_DCT_TOKENS-1] =
{
{
204, 170, 119, 235, 140, 230, 228,
128, 130, 130, 74, 148, 180, 203, 236, 254, 254 }
};
+
+#endif /* AVCODEC_VP8DATA_H */