91
92
static inline void dv_calc_mb_coordinates(const DVprofile *d, int chan, int seq, int slot,
94
const static uint8_t off[] = { 2, 6, 8, 0, 4 };
95
const static uint8_t shuf1[] = { 36, 18, 54, 0, 72 };
96
const static uint8_t shuf2[] = { 24, 12, 36, 0, 48 };
97
const static uint8_t shuf3[] = { 18, 9, 27, 0, 36 };
99
const static uint8_t l_start[] = {0, 4, 9, 13, 18, 22, 27, 31, 36, 40};
100
const static uint8_t l_start_shuffled[] = { 9, 4, 13, 0, 18 };
102
const static uint8_t serpent1[] = {0, 1, 2, 2, 1, 0,
95
static const uint8_t off[] = { 2, 6, 8, 0, 4 };
96
static const uint8_t shuf1[] = { 36, 18, 54, 0, 72 };
97
static const uint8_t shuf2[] = { 24, 12, 36, 0, 48 };
98
static const uint8_t shuf3[] = { 18, 9, 27, 0, 36 };
100
static const uint8_t l_start[] = {0, 4, 9, 13, 18, 22, 27, 31, 36, 40};
101
static const uint8_t l_start_shuffled[] = { 9, 4, 13, 0, 18 };
103
static const uint8_t serpent1[] = {0, 1, 2, 2, 1, 0,
103
104
0, 1, 2, 2, 1, 0,
104
105
0, 1, 2, 2, 1, 0,
105
106
0, 1, 2, 2, 1, 0,
107
const static uint8_t serpent2[] = {0, 1, 2, 3, 4, 5, 5, 4, 3, 2, 1, 0,
108
static const uint8_t serpent2[] = {0, 1, 2, 3, 4, 5, 5, 4, 3, 2, 1, 0,
108
109
0, 1, 2, 3, 4, 5, 5, 4, 3, 2, 1, 0,
109
110
0, 1, 2, 3, 4, 5};
111
const static uint8_t remap[][2] = {{ 0, 0}, { 0, 0}, { 0, 0}, { 0, 0}, /* dummy */
112
static const uint8_t remap[][2] = {{ 0, 0}, { 0, 0}, { 0, 0}, { 0, 0}, /* dummy */
112
113
{ 0, 0}, { 0, 1}, { 0, 2}, { 0, 3}, {10, 0},
113
114
{10, 1}, {10, 2}, {10, 3}, {20, 0}, {20, 1},
114
115
{20, 2}, {20, 3}, {30, 0}, {30, 1}, {30, 2},
808
//FIXME replace this by dsputil
809
#define SC(x, y) ((s[x] - s[y]) ^ ((s[x] - s[y]) >> 7))
810
static av_always_inline int dv_guess_dct_mode(DCTELEM *blk) {
816
/* Compute 8-8 score (small values give a better chance for 8-8 DCT) */
818
for (i = 0; i < 7; i++) {
819
score88 += SC(0, 8) + SC(1, 9) + SC(2, 10) + SC(3, 11) +
820
SC(4, 12) + SC(5,13) + SC(6, 14) + SC(7, 15);
823
/* Compute 2-4-8 score (small values give a better chance for 2-4-8 DCT) */
825
for (i = 0; i < 6; i++) {
826
score248 += SC(0, 16) + SC(1,17) + SC(2, 18) + SC(3, 19) +
827
SC(4, 20) + SC(5,21) + SC(6, 22) + SC(7, 23);
831
return (score88 - score248 > -10);
811
static av_always_inline int dv_guess_dct_mode(DVVideoContext *s, uint8_t *data, int linesize) {
812
if (s->avctx->flags & CODEC_FLAG_INTERLACED_DCT) {
813
int ps = s->ildct_cmp(NULL, data, NULL, linesize, 8) - 400;
815
int is = s->ildct_cmp(NULL, data , NULL, linesize<<1, 4) +
816
s->ildct_cmp(NULL, data + linesize, NULL, linesize<<1, 4);
834
824
static av_always_inline int dv_init_enc_block(EncBlockInfo* bi, uint8_t *data, int linesize, DVVideoContext *s, int bias)