mirror of
https://github.com/FFmpeg/FFmpeg.git
synced 2025-01-29 22:00:58 +02:00
Merge commit '64bb3fa6b7f5b2db22b7577585d5861be24eebd8'
* commit '64bb3fa6b7f5b2db22b7577585d5861be24eebd8': cavs: cosmetics, reformat top part cavsdec: cosmetics, reformat libavcodec/utils: Add braces to shut up gcc warnings Conflicts: libavcodec/cavsdec.c libavcodec/utils.c Merged-by: Michael Niedermayer <michaelni@gmx.at>
This commit is contained in:
commit
6ddda83c3f
@ -67,7 +67,8 @@ static const int8_t top_modifier_c[7] = { 4, 1, -1, -1, 4, 6, 6 };
|
||||
*
|
||||
****************************************************************************/
|
||||
|
||||
static inline int get_bs(cavs_vector *mvP, cavs_vector *mvQ, int b) {
|
||||
static inline int get_bs(cavs_vector *mvP, cavs_vector *mvQ, int b)
|
||||
{
|
||||
if ((mvP->ref == REF_INTRA) || (mvQ->ref == REF_INTRA))
|
||||
return 2;
|
||||
if ((abs(mvP->x - mvQ->x) >= 4) || (abs(mvP->y - mvQ->y) >= 4))
|
||||
@ -101,7 +102,8 @@ static inline int get_bs(cavs_vector *mvP, cavs_vector *mvQ, int b) {
|
||||
* ---------
|
||||
*
|
||||
*/
|
||||
void ff_cavs_filter(AVSContext *h, enum cavs_mb mb_type) {
|
||||
void ff_cavs_filter(AVSContext *h, enum cavs_mb mb_type)
|
||||
{
|
||||
uint8_t bs[8];
|
||||
int qp_avg, alpha, beta, tc;
|
||||
int i;
|
||||
@ -149,8 +151,7 @@ void ff_cavs_filter(AVSContext *h, enum cavs_mb mb_type) {
|
||||
qp_avg = h->qp;
|
||||
SET_PARAMS;
|
||||
h->cdsp.cavs_filter_lv(h->cy + 8, h->l_stride, alpha, beta, tc, bs[2], bs[3]);
|
||||
h->cdsp.cavs_filter_lh(h->cy + 8*h->l_stride,h->l_stride,alpha,beta,tc,
|
||||
bs[6],bs[7]);
|
||||
h->cdsp.cavs_filter_lh(h->cy + 8 * h->l_stride, h->l_stride, alpha, beta, tc, bs[6], bs[7]);
|
||||
|
||||
if (h->flags & B_AVAIL) {
|
||||
qp_avg = (h->qp + h->top_qp[h->mbx] + 1) >> 1;
|
||||
@ -174,7 +175,8 @@ void ff_cavs_filter(AVSContext *h, enum cavs_mb mb_type) {
|
||||
****************************************************************************/
|
||||
|
||||
void ff_cavs_load_intra_pred_luma(AVSContext *h, uint8_t *top,
|
||||
uint8_t **left, int block) {
|
||||
uint8_t **left, int block)
|
||||
{
|
||||
int i;
|
||||
|
||||
switch (block) {
|
||||
@ -223,7 +225,8 @@ void ff_cavs_load_intra_pred_luma(AVSContext *h, uint8_t *top,
|
||||
}
|
||||
}
|
||||
|
||||
void ff_cavs_load_intra_pred_chroma(AVSContext *h) {
|
||||
void ff_cavs_load_intra_pred_chroma(AVSContext *h)
|
||||
{
|
||||
/* extend borders by one pixel */
|
||||
h->left_border_u[9] = h->left_border_u[8];
|
||||
h->left_border_v[9] = h->left_border_v[8];
|
||||
@ -240,7 +243,8 @@ void ff_cavs_load_intra_pred_chroma(AVSContext *h) {
|
||||
}
|
||||
}
|
||||
|
||||
static void intra_pred_vert(uint8_t *d,uint8_t *top,uint8_t *left,int stride) {
|
||||
static void intra_pred_vert(uint8_t *d,uint8_t *top,uint8_t *left,int stride)
|
||||
{
|
||||
int y;
|
||||
uint64_t a = AV_RN64(&top[1]);
|
||||
for (y = 0; y < 8; y++) {
|
||||
@ -248,7 +252,8 @@ static void intra_pred_vert(uint8_t *d,uint8_t *top,uint8_t *left,int stride) {
|
||||
}
|
||||
}
|
||||
|
||||
static void intra_pred_horiz(uint8_t *d,uint8_t *top,uint8_t *left,int stride) {
|
||||
static void intra_pred_horiz(uint8_t *d,uint8_t *top,uint8_t *left,int stride)
|
||||
{
|
||||
int y;
|
||||
uint64_t a;
|
||||
for (y = 0; y < 8; y++) {
|
||||
@ -257,14 +262,16 @@ static void intra_pred_horiz(uint8_t *d,uint8_t *top,uint8_t *left,int stride) {
|
||||
}
|
||||
}
|
||||
|
||||
static void intra_pred_dc_128(uint8_t *d,uint8_t *top,uint8_t *left,int stride) {
|
||||
static void intra_pred_dc_128(uint8_t *d,uint8_t *top,uint8_t *left,int stride)
|
||||
{
|
||||
int y;
|
||||
uint64_t a = 0x8080808080808080ULL;
|
||||
for (y = 0; y < 8; y++)
|
||||
*((uint64_t *)(d + y * stride)) = a;
|
||||
}
|
||||
|
||||
static void intra_pred_plane(uint8_t *d,uint8_t *top,uint8_t *left,int stride) {
|
||||
static void intra_pred_plane(uint8_t *d,uint8_t *top,uint8_t *left,int stride)
|
||||
{
|
||||
int x, y, ia;
|
||||
int ih = 0;
|
||||
int iv = 0;
|
||||
@ -285,21 +292,24 @@ static void intra_pred_plane(uint8_t *d,uint8_t *top,uint8_t *left,int stride) {
|
||||
#define LOWPASS(ARRAY,INDEX) \
|
||||
((ARRAY[(INDEX) - 1] + 2 * ARRAY[(INDEX)] + ARRAY[(INDEX) + 1] + 2) >> 2)
|
||||
|
||||
static void intra_pred_lp(uint8_t *d,uint8_t *top,uint8_t *left,int stride) {
|
||||
static void intra_pred_lp(uint8_t *d,uint8_t *top,uint8_t *left,int stride)
|
||||
{
|
||||
int x, y;
|
||||
for (y = 0; y < 8; y++)
|
||||
for (x = 0; x < 8; x++)
|
||||
d[y * stride + x] = (LOWPASS(top, x + 1) + LOWPASS(left, y + 1)) >> 1;
|
||||
}
|
||||
|
||||
static void intra_pred_down_left(uint8_t *d,uint8_t *top,uint8_t *left,int stride) {
|
||||
static void intra_pred_down_left(uint8_t *d,uint8_t *top,uint8_t *left,int stride)
|
||||
{
|
||||
int x, y;
|
||||
for (y = 0; y < 8; y++)
|
||||
for (x = 0; x < 8; x++)
|
||||
d[y * stride + x] = (LOWPASS(top, x + y + 2) + LOWPASS(left, x + y + 2)) >> 1;
|
||||
}
|
||||
|
||||
static void intra_pred_down_right(uint8_t *d,uint8_t *top,uint8_t *left,int stride) {
|
||||
static void intra_pred_down_right(uint8_t *d,uint8_t *top,uint8_t *left,int stride)
|
||||
{
|
||||
int x, y;
|
||||
for (y = 0; y < 8; y++)
|
||||
for (x = 0; x < 8; x++)
|
||||
@ -311,14 +321,16 @@ static void intra_pred_down_right(uint8_t *d,uint8_t *top,uint8_t *left,int stri
|
||||
d[y * stride + x] = LOWPASS(left, y - x);
|
||||
}
|
||||
|
||||
static void intra_pred_lp_left(uint8_t *d,uint8_t *top,uint8_t *left,int stride) {
|
||||
static void intra_pred_lp_left(uint8_t *d,uint8_t *top,uint8_t *left,int stride)
|
||||
{
|
||||
int x, y;
|
||||
for (y = 0; y < 8; y++)
|
||||
for (x = 0; x < 8; x++)
|
||||
d[y * stride + x] = LOWPASS(left, y + 1);
|
||||
}
|
||||
|
||||
static void intra_pred_lp_top(uint8_t *d,uint8_t *top,uint8_t *left,int stride) {
|
||||
static void intra_pred_lp_top(uint8_t *d,uint8_t *top,uint8_t *left,int stride)
|
||||
{
|
||||
int x, y;
|
||||
for (y = 0; y < 8; y++)
|
||||
for (x = 0; x < 8; x++)
|
||||
@ -336,7 +348,8 @@ static inline void modify_pred(const int8_t *mod_table, int *mode)
|
||||
}
|
||||
}
|
||||
|
||||
void ff_cavs_modify_mb_i(AVSContext *h, int *pred_mode_uv) {
|
||||
void ff_cavs_modify_mb_i(AVSContext *h, int *pred_mode_uv)
|
||||
{
|
||||
/* save pred modes before they get modified */
|
||||
h->pred_mode_Y[3] = h->pred_mode_Y[5];
|
||||
h->pred_mode_Y[6] = h->pred_mode_Y[8];
|
||||
|
@ -96,12 +96,12 @@ static const struct dec_2dvlc intra_dec[7] = {
|
||||
{ 2, 5, 2 }, { -2, 5, 2 }, { 1, 23, 1 }, { -1, 23, 1 }, { EOB }
|
||||
},
|
||||
//level_add
|
||||
{ 0, 4, 3, 3, 3, 3, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
|
||||
2, 2, 2, 2, 2, 2, 2,-1,-1,-1},
|
||||
{ 0, 4, 3, 3, 3, 3, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, -1, -1, -1 },
|
||||
2, //golomb_order
|
||||
0, //inc_limit
|
||||
23, //max_run
|
||||
},{
|
||||
},
|
||||
{
|
||||
{ //level / run
|
||||
{ 1, 1, 0 }, { -1, 1, 0 }, { 1, 2, 0 }, { -1, 2, 0 }, { 2, 1, 1 }, { -2, 1, 1 },
|
||||
{ 1, 3, 0 }, { -1, 3, 0 }, { EOB }, { 1, 4, 0 }, { -1, 4, 0 }, { 1, 5, 0 },
|
||||
@ -115,12 +115,12 @@ static const struct dec_2dvlc intra_dec[7] = {
|
||||
{ -3, 3, 2 }, { 6, 1, 3 }, { -6, 1, 3 }, { 1, 15, 0 }, { -1, 15, 0 }
|
||||
},
|
||||
//level_add
|
||||
{ 0, 7, 4, 4, 3, 3, 3, 3, 3, 2, 2, 2, 2, 2, 2, 2,-1,
|
||||
-1,-1,-1,-1,-1,-1,-1,-1,-1,-1},
|
||||
{ 0, 7, 4, 4, 3, 3, 3, 3, 3, 2, 2, 2, 2, 2, 2, 2, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1 },
|
||||
2, //golomb_order
|
||||
1, //inc_limit
|
||||
15, //max_run
|
||||
},{
|
||||
},
|
||||
{
|
||||
{ //level / run
|
||||
{ 1, 1, 0 }, { -1, 1, 0 }, { 2, 1, 0 }, { -2, 1, 0 }, { 1, 2, 0 }, { -1, 2, 0 },
|
||||
{ 3, 1, 1 }, { -3, 1, 1 }, { EOB }, { 1, 3, 0 }, { -1, 3, 0 }, { 2, 2, 0 },
|
||||
@ -134,12 +134,12 @@ static const struct dec_2dvlc intra_dec[7] = {
|
||||
{ -2, 7, 0 }, { 9, 1, 3 }, { -9, 1, 3 }, { 1, 10, 0 }, { -1, 10, 0 }
|
||||
},
|
||||
//level_add
|
||||
{ 0,10, 6, 4, 4, 3, 3, 3, 2, 2, 2,-1,-1,-1,-1,-1,-1,
|
||||
-1,-1,-1,-1,-1,-1,-1,-1,-1,-1},
|
||||
{ 0, 10, 6, 4, 4, 3, 3, 3, 2, 2, 2, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1 },
|
||||
2, //golomb_order
|
||||
2, //inc_limit
|
||||
10, //max_run
|
||||
},{
|
||||
},
|
||||
{
|
||||
{ //level / run
|
||||
{ 1, 1, 0 }, { -1, 1, 0 }, { 2, 1, 0 }, { -2, 1, 0 }, { 3, 1, 0 }, { -3, 1, 0 },
|
||||
{ 1, 2, 0 }, { -1, 2, 0 }, { EOB }, { 4, 1, 0 }, { -4, 1, 0 }, { 5, 1, 1 },
|
||||
@ -153,12 +153,12 @@ static const struct dec_2dvlc intra_dec[7] = {
|
||||
{ -3, 4, 0 }, { 12, 1, 3 }, {-12, 1, 3 }, { 4, 3, 0 }, { -4, 3, 0 }
|
||||
},
|
||||
//level_add
|
||||
{ 0,13, 7, 5, 4, 3, 2, 2,-1,-1,-1 -1,-1,-1,-1,-1,-1,
|
||||
-1,-1,-1,-1,-1,-1,-1,-1,-1,-1},
|
||||
{ 0, 13, 7, 5, 4, 3, 2, 2, -1, -1, -1 -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1 },
|
||||
2, //golomb_order
|
||||
4, //inc_limit
|
||||
7, //max_run
|
||||
},{
|
||||
},
|
||||
{
|
||||
{ //level / run
|
||||
{ 1, 1, 0 }, { -1, 1, 0 }, { 2, 1, 0 }, { -2, 1, 0 }, { 3, 1, 0 }, { -3, 1, 0 },
|
||||
{ EOB }, { 4, 1, 0 }, { -4, 1, 0 }, { 5, 1, 0 }, { -5, 1, 0 }, { 6, 1, 0 },
|
||||
@ -172,12 +172,12 @@ static const struct dec_2dvlc intra_dec[7] = {
|
||||
{ -1, 5, 0 }, { 7, 2, 0 }, { -7, 2, 0 }, { 17, 1, 2 }, {-17, 1, 2 }
|
||||
},
|
||||
//level_add
|
||||
{ 0,18, 8, 4, 2, 2,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,
|
||||
-1,-1,-1,-1,-1,-1,-1,-1,-1,-1},
|
||||
{ 0,18, 8, 4, 2, 2, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1 },
|
||||
2, //golomb_order
|
||||
7, //inc_limit
|
||||
5, //max_run
|
||||
},{
|
||||
},
|
||||
{
|
||||
{ //level / run
|
||||
{ EOB }, { 1, 1, 0 }, { -1, 1, 0 }, { 2, 1, 0 }, { -2, 1, 0 }, { 3, 1, 0 },
|
||||
{ -3, 1, 0 }, { 4, 1, 0 }, { -4, 1, 0 }, { 5, 1, 0 }, { -5, 1, 0 }, { 6, 1, 0 },
|
||||
@ -191,12 +191,12 @@ static const struct dec_2dvlc intra_dec[7] = {
|
||||
{ -6, 2, 0 }, { 21, 1, 1 }, {-21, 1, 1 }, { 2, 3, 0 }, { -2, 3, 0 }
|
||||
},
|
||||
//level_add
|
||||
{ 0,22, 7, 3,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,
|
||||
-1,-1,-1,-1,-1,-1,-1,-1,-1,-1},
|
||||
{ 0, 22, 7, 3, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1 },
|
||||
2, //golomb_order
|
||||
10, //inc_limit
|
||||
3, //max_run
|
||||
},{
|
||||
},
|
||||
{
|
||||
{ //level / run
|
||||
{ EOB }, { 1, 1, 0 }, { -1, 1, 0 }, { 2, 1, 0 }, { -2, 1, 0 }, { 3, 1, 0 },
|
||||
{ -3, 1, 0 }, { 4, 1, 0 }, { -4, 1, 0 }, { 5, 1, 0 }, { -5, 1, 0 }, { 6, 1, 0 },
|
||||
@ -210,8 +210,7 @@ static const struct dec_2dvlc intra_dec[7] = {
|
||||
{-25, 1, 0 }, { 3, 2, 0 }, { -3, 2, 0 }, { 26, 1, 0 }, {-26, 1, 0 }
|
||||
},
|
||||
//level_add
|
||||
{ 0,27, 4,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,
|
||||
-1,-1,-1,-1,-1,-1,-1,-1,-1,-1},
|
||||
{ 0, 27, 4, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1 },
|
||||
2, //golomb_order
|
||||
INT_MAX, //inc_limit
|
||||
2, //max_run
|
||||
@ -233,12 +232,12 @@ static const struct dec_2dvlc inter_dec[7] = {
|
||||
{ 1, 25, 1 }, { -1, 25, 1 }, { 1, 26, 1 }, { -1, 26, 1 }, { EOB }
|
||||
},
|
||||
//level_add
|
||||
{ 0, 4, 3, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
|
||||
2, 2, 2, 2, 2, 2, 2, 2, 2, 2},
|
||||
{ 0, 4, 3, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2 },
|
||||
3, //golomb_order
|
||||
0, //inc_limit
|
||||
26 //max_run
|
||||
},{
|
||||
},
|
||||
{
|
||||
{ //level / run
|
||||
{ 1, 1, 0 }, { -1, 1, 0 }, { EOB }, { 1, 2, 0 }, { -1, 2, 0 }, { 1, 3, 0 },
|
||||
{ -1, 3, 0 }, { 1, 4, 0 }, { -1, 4, 0 }, { 1, 5, 0 }, { -1, 5, 0 }, { 1, 6, 0 },
|
||||
@ -252,12 +251,12 @@ static const struct dec_2dvlc inter_dec[7] = {
|
||||
{ -1, 19, 0 }, { 2, 7, 1 }, { -2, 7, 1 }, { 3, 2, 2 }, { -3, 2, 2 }
|
||||
},
|
||||
//level_add
|
||||
{ 0, 5, 4, 3, 3, 3, 3, 3, 2, 2, 2, 2, 2, 2, 2, 2, 2,
|
||||
2, 2, 2,-1,-1,-1,-1,-1,-1,-1},
|
||||
{ 0, 5, 4, 3, 3, 3, 3, 3, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, -1, -1, -1, -1, -1, -1, -1 },
|
||||
2, //golomb_order
|
||||
1, //inc_limit
|
||||
19 //max_run
|
||||
},{
|
||||
},
|
||||
{
|
||||
{ //level / run
|
||||
{ 1, 1, 0 }, { -1, 1, 0 }, { EOB }, { 1, 2, 0 }, { -1, 2, 0 }, { 2, 1, 0 },
|
||||
{ -2, 1, 0 }, { 1, 3, 0 }, { -1, 3, 0 }, { 1, 4, 0 }, { -1, 4, 0 }, { 3, 1, 1 },
|
||||
@ -271,12 +270,12 @@ static const struct dec_2dvlc inter_dec[7] = {
|
||||
{ -2, 7, 0 }, { 3, 4, 1 }, { -3, 4, 1 }, { 1, 14, 0 }, { -1, 14, 0 }
|
||||
},
|
||||
//level_add
|
||||
{ 0, 7, 5, 4, 4, 3, 3, 3, 2, 2, 2, 2, 2, 2, 2,-1,-1,
|
||||
-1,-1,-1,-1,-1,-1,-1,-1,-1,-1},
|
||||
{ 0, 7, 5, 4, 4, 3, 3, 3, 2, 2, 2, 2, 2, 2, 2, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1 },
|
||||
2, //golomb_order
|
||||
2, //inc_limit
|
||||
14 //max_run
|
||||
},{
|
||||
},
|
||||
{
|
||||
{ //level / run
|
||||
{ 1, 1, 0 }, { -1, 1, 0 }, { EOB }, { 2, 1, 0 }, { -2, 1, 0 }, { 1, 2, 0 },
|
||||
{ -1, 2, 0 }, { 3, 1, 0 }, { -3, 1, 0 }, { 1, 3, 0 }, { -1, 3, 0 }, { 2, 2, 0 },
|
||||
@ -290,12 +289,12 @@ static const struct dec_2dvlc inter_dec[7] = {
|
||||
{ -1, 10, 0 }, { 9, 1, 2 }, { -9, 1, 2 }, { 4, 3, 1 }, { -4, 3, 1 }
|
||||
},
|
||||
//level_add
|
||||
{ 0,10, 6, 5, 4, 3, 3, 2, 2, 2, 2,-1,-1,-1,-1,-1,-1,
|
||||
-1,-1,-1,-1,-1,-1,-1,-1,-1,-1},
|
||||
{ 0,10, 6, 5, 4, 3, 3, 2, 2, 2, 2, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1 },
|
||||
2, //golomb_order
|
||||
3, //inc_limit
|
||||
10 //max_run
|
||||
},{
|
||||
},
|
||||
{
|
||||
{ //level / run
|
||||
{ 1, 1, 0 }, { -1, 1, 0 }, { EOB }, { 2, 1, 0 }, { -2, 1, 0 }, { 3, 1, 0 },
|
||||
{ -3, 1, 0 }, { 1, 2, 0 }, { -1, 2, 0 }, { 4, 1, 0 }, { -4, 1, 0 }, { 5, 1, 0 },
|
||||
@ -309,12 +308,12 @@ static const struct dec_2dvlc inter_dec[7] = {
|
||||
{ -2, 5, 0 }, { 12, 1, 2 }, {-12, 1, 2 }, { 4, 3, 0 }, { -4, 3, 0 }
|
||||
},
|
||||
//level_add
|
||||
{ 0,13, 7, 5, 4, 3, 2, 2,-1,-1,-1,-1,-1,-1,-1,-1,-1,
|
||||
-1,-1,-1,-1,-1,-1,-1,-1,-1,-1},
|
||||
{ 0, 13, 7, 5, 4, 3, 2, 2, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1 },
|
||||
2, //golomb_order
|
||||
6, //inc_limit
|
||||
7 //max_run
|
||||
},{
|
||||
},
|
||||
{
|
||||
{ //level / run
|
||||
{ EOB }, { 1, 1, 0 }, { -1, 1, 0 }, { 2, 1, 0 }, { -2, 1, 0 }, { 3, 1, 0 },
|
||||
{ -3, 1, 0 }, { 4, 1, 0 }, { -4, 1, 0 }, { 5, 1, 0 }, { -5, 1, 0 }, { 1, 2, 0 },
|
||||
@ -328,12 +327,12 @@ static const struct dec_2dvlc inter_dec[7] = {
|
||||
{ -16, 1, 1 }, { 2, 4, 0 }, { -2, 4, 0 }, { 7, 2, 0 }, { -7, 2, 0 }
|
||||
},
|
||||
//level_add
|
||||
{ 0,17, 8, 4, 3, 2,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,
|
||||
-1,-1,-1,-1,-1,-1,-1,-1,-1,-1},
|
||||
{ 0, 17, 8, 4, 3, 2, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1 },
|
||||
2, //golomb_order
|
||||
9, //inc_limit
|
||||
5 //max_run
|
||||
},{
|
||||
},
|
||||
{
|
||||
{ //level / run
|
||||
{ EOB }, { 1, 1, 0 }, { -1, 1, 0 }, { 2, 1, 0 }, { -2, 1, 0 }, { 3, 1, 0 },
|
||||
{ -3, 1, 0 }, { 4, 1, 0 }, { -4, 1, 0 }, { 5, 1, 0 }, { -5, 1, 0 }, { 6, 1, 0 },
|
||||
@ -347,8 +346,7 @@ static const struct dec_2dvlc inter_dec[7] = {
|
||||
{ -1, 4, 0 }, { 5, 2, 0 }, { -5, 2, 0 }, { 21, 1, 0 }, { -21, 1, 0 }
|
||||
},
|
||||
//level_add
|
||||
{ 0,22, 6, 3, 2,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,
|
||||
-1,-1,-1,-1,-1,-1,-1,-1,-1,-1},
|
||||
{ 0, 22, 6, 3, 2, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1 },
|
||||
2, //golomb_order
|
||||
INT_MAX, //inc_limit
|
||||
4 //max_run
|
||||
@ -370,12 +368,12 @@ static const struct dec_2dvlc chroma_dec[5] = {
|
||||
{ 1, 25, 1 }, { -1, 25, 1 }, { 4, 1, 3 }, { -4, 1, 3 }, { EOB }
|
||||
},
|
||||
//level_add
|
||||
{ 0, 5, 3, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
|
||||
2, 2, 2, 2, 2, 2, 2, 2, 2,-1},
|
||||
{ 0, 5, 3, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, -1 },
|
||||
2, //golomb_order
|
||||
0, //inc_limit
|
||||
25 //max_run
|
||||
},{
|
||||
},
|
||||
{
|
||||
{ //level / run
|
||||
{ EOB }, { 1, 1, 0 }, { -1, 1, 0 }, { 1, 2, 0 }, { -1, 2, 0 }, { 2, 1, 1 },
|
||||
{ -2, 1, 1 }, { 1, 3, 0 }, { -1, 3, 0 }, { 1, 4, 0 }, { -1, 4, 0 }, { 1, 5, 0 },
|
||||
@ -389,12 +387,12 @@ static const struct dec_2dvlc chroma_dec[5] = {
|
||||
{ -2, 5, 1 }, { 1, 19, 0 }, { -1, 19, 0 }, { 1, 20, 0 }, { -1, 20, 0 }
|
||||
},
|
||||
//level_add
|
||||
{ 0, 6, 4, 3, 3, 3, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
|
||||
2, 2, 2, 2,-1,-1,-1,-1,-1,-1},
|
||||
{ 0, 6, 4, 3, 3, 3, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, -1, -1, -1, -1, -1, -1 },
|
||||
0, //golomb_order
|
||||
1, //inc_limit
|
||||
20 //max_run
|
||||
},{
|
||||
},
|
||||
{
|
||||
{ //level / run
|
||||
{ 1, 1, 0 }, { -1, 1, 0 }, { EOB }, { 2, 1, 0 }, { -2, 1, 0 }, { 1, 2, 0 },
|
||||
{ -1, 2, 0 }, { 3, 1, 1 }, { -3, 1, 1 }, { 1, 3, 0 }, { -1, 3, 0 }, { 4, 1, 1 },
|
||||
@ -408,12 +406,12 @@ static const struct dec_2dvlc chroma_dec[5] = {
|
||||
{ -9, 1, 2 }, { 5, 2, 2 }, { -5, 2, 2 }, { 3, 4, 1 }, { -3, 4, 1 },
|
||||
},
|
||||
//level_add
|
||||
{ 0,10, 6, 4, 4, 3, 3, 2, 2, 2, 2, 2,-1,-1,-1,-1,-1,
|
||||
-1,-1,-1,-1,-1,-1,-1,-1,-1,-1},
|
||||
{ 0,10, 6, 4, 4, 3, 3, 2, 2, 2, 2, 2, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1 },
|
||||
1, //golomb_order
|
||||
2, //inc_limit
|
||||
11 //max_run
|
||||
},{
|
||||
},
|
||||
{
|
||||
{ //level / run
|
||||
{ EOB }, { 1, 1, 0 }, { -1, 1, 0 }, { 2, 1, 0 }, { -2, 1, 0 }, { 3, 1, 0 },
|
||||
{ -3, 1, 0 }, { 4, 1, 0 }, { -4, 1, 0 }, { 1, 2, 0 }, { -1, 2, 0 }, { 5, 1, 1 },
|
||||
@ -427,12 +425,12 @@ static const struct dec_2dvlc chroma_dec[5] = {
|
||||
{-13, 1, 1 }, { 2, 5, 0 }, { -2, 5, 0 }, { 1, 8, 0 }, { -1, 8, 0 },
|
||||
},
|
||||
//level_add
|
||||
{ 0,14, 7, 4, 3, 3, 2, 2, 2,-1,-1,-1,-1,-1,-1,-1,-1,
|
||||
-1,-1,-1,-1,-1,-1,-1,-1,-1,-1},
|
||||
{ 0, 14, 7, 4, 3, 3, 2, 2, 2, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1 },
|
||||
1, //golomb_order
|
||||
4, //inc_limit
|
||||
8 //max_run
|
||||
},{
|
||||
},
|
||||
{
|
||||
{ //level / run
|
||||
{ EOB }, { 1, 1, 0 }, { -1, 1, 0 }, { 2, 1, 0 }, { -2, 1, 0 }, { 3, 1, 0 },
|
||||
{ -3, 1, 0 }, { 4, 1, 0 }, { -4, 1, 0 }, { 5, 1, 0 }, { -5, 1, 0 }, { 6, 1, 0 },
|
||||
@ -446,8 +444,7 @@ static const struct dec_2dvlc chroma_dec[5] = {
|
||||
{ -6, 2, 0 }, { 19, 1, 0 }, { -19, 1, 0 }, { 1, 5, 0 }, { -1, 5, 0 },
|
||||
},
|
||||
//level_add
|
||||
{ 0,20, 7, 3, 2, 2,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,
|
||||
-1,-1,-1,-1,-1,-1,-1,-1,-1,-1},
|
||||
{ 0, 20, 7, 3, 2, 2, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1 },
|
||||
0, //golomb_order
|
||||
INT_MAX, //inc_limit
|
||||
5, //max_run
|
||||
@ -462,7 +459,8 @@ static const struct dec_2dvlc chroma_dec[5] = {
|
||||
*
|
||||
****************************************************************************/
|
||||
|
||||
static inline void store_mvs(AVSContext *h) {
|
||||
static inline void store_mvs(AVSContext *h)
|
||||
{
|
||||
h->col_mv[h->mbidx * 4 + 0] = h->mv[MV_FWD_X0];
|
||||
h->col_mv[h->mbidx * 4 + 1] = h->mv[MV_FWD_X1];
|
||||
h->col_mv[h->mbidx * 4 + 2] = h->mv[MV_FWD_X2];
|
||||
@ -470,7 +468,8 @@ static inline void store_mvs(AVSContext *h) {
|
||||
}
|
||||
|
||||
static inline void mv_pred_direct(AVSContext *h, cavs_vector *pmv_fw,
|
||||
cavs_vector *col_mv) {
|
||||
cavs_vector *col_mv)
|
||||
{
|
||||
cavs_vector *pmv_bw = pmv_fw + MV_BWD_OFFS;
|
||||
int den = h->direct_den[col_mv->ref];
|
||||
int m = col_mv->x >> 31;
|
||||
@ -487,7 +486,9 @@ static inline void mv_pred_direct(AVSContext *h, cavs_vector *pmv_fw,
|
||||
pmv_bw->y = m - (((den + (den * col_mv->y * pmv_bw->dist ^ m) - m - 1) >> 14) ^ m);
|
||||
}
|
||||
|
||||
static inline void mv_pred_sym(AVSContext *h, cavs_vector *src, enum cavs_block size) {
|
||||
static inline void mv_pred_sym(AVSContext *h, cavs_vector *src,
|
||||
enum cavs_block size)
|
||||
{
|
||||
cavs_vector *dst = src + MV_BWD_OFFS;
|
||||
|
||||
/* backward mv is the scaled and negated forward mv */
|
||||
@ -505,7 +506,8 @@ static inline void mv_pred_sym(AVSContext *h, cavs_vector *src, enum cavs_block
|
||||
****************************************************************************/
|
||||
|
||||
/** kth-order exponential golomb code */
|
||||
static inline int get_ue_code(GetBitContext *gb, int order) {
|
||||
static inline int get_ue_code(GetBitContext *gb, int order)
|
||||
{
|
||||
if (order) {
|
||||
int ret = get_ue_golomb(gb) << order;
|
||||
return ret + get_bits(gb, order);
|
||||
@ -514,7 +516,8 @@ static inline int get_ue_code(GetBitContext *gb, int order) {
|
||||
}
|
||||
|
||||
static inline int dequant(AVSContext *h, DCTELEM *level_buf, uint8_t *run_buf,
|
||||
DCTELEM *dst, int mul, int shift, int coeff_num) {
|
||||
DCTELEM *dst, int mul, int shift, int coeff_num)
|
||||
{
|
||||
int round = 1 << (shift - 1);
|
||||
int pos = -1;
|
||||
const uint8_t *scantab = h->scantable.permutated;
|
||||
@ -544,7 +547,8 @@ static inline int dequant(AVSContext *h, DCTELEM *level_buf, uint8_t *run_buf,
|
||||
*/
|
||||
static int decode_residual_block(AVSContext *h, GetBitContext *gb,
|
||||
const struct dec_2dvlc *r, int esc_golomb_order,
|
||||
int qp, uint8_t *dst, int stride) {
|
||||
int qp, uint8_t *dst, int stride)
|
||||
{
|
||||
int i, esc_code, level, mask;
|
||||
unsigned int level_code, run;
|
||||
DCTELEM level_buf[65];
|
||||
@ -582,7 +586,8 @@ static int decode_residual_block(AVSContext *h, GetBitContext *gb,
|
||||
}
|
||||
|
||||
|
||||
static inline void decode_residual_chroma(AVSContext *h) {
|
||||
static inline void decode_residual_chroma(AVSContext *h)
|
||||
{
|
||||
if (h->cbp & (1 << 4))
|
||||
decode_residual_block(h, &h->s.gb, chroma_dec, 0,
|
||||
cavs_chroma_qp[h->qp], h->cu, h->c_stride);
|
||||
@ -591,7 +596,8 @@ static inline void decode_residual_chroma(AVSContext *h) {
|
||||
cavs_chroma_qp[h->qp], h->cv, h->c_stride);
|
||||
}
|
||||
|
||||
static inline int decode_residual_inter(AVSContext *h) {
|
||||
static inline int decode_residual_inter(AVSContext *h)
|
||||
{
|
||||
int block;
|
||||
|
||||
/* get coded block pattern */
|
||||
@ -620,7 +626,8 @@ static inline int decode_residual_inter(AVSContext *h) {
|
||||
*
|
||||
****************************************************************************/
|
||||
|
||||
static inline void set_mv_intra(AVSContext *h) {
|
||||
static inline void set_mv_intra(AVSContext *h)
|
||||
{
|
||||
h->mv[MV_FWD_X0] = ff_cavs_intra_mv;
|
||||
set_mvs(&h->mv[MV_FWD_X0], BLK_16X16);
|
||||
h->mv[MV_BWD_X0] = ff_cavs_intra_mv;
|
||||
@ -629,7 +636,8 @@ static inline void set_mv_intra(AVSContext *h) {
|
||||
h->col_type_base[h->mbidx] = I_8X8;
|
||||
}
|
||||
|
||||
static int decode_mb_i(AVSContext *h, int cbp_code) {
|
||||
static int decode_mb_i(AVSContext *h, int cbp_code)
|
||||
{
|
||||
GetBitContext *gb = &h->s.gb;
|
||||
unsigned pred_mode_uv;
|
||||
int block;
|
||||
@ -696,7 +704,8 @@ static int decode_mb_i(AVSContext *h, int cbp_code) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
static inline void set_intra_mode_default(AVSContext *h) {
|
||||
static inline void set_intra_mode_default(AVSContext *h)
|
||||
{
|
||||
if (h->stream_revision > 0) {
|
||||
h->pred_mode_Y[3] = h->pred_mode_Y[6] = NOT_AVAIL;
|
||||
h->top_pred_Y[h->mbx * 2 + 0] = h->top_pred_Y[h->mbx * 2 + 1] = NOT_AVAIL;
|
||||
@ -706,7 +715,8 @@ static inline void set_intra_mode_default(AVSContext *h) {
|
||||
}
|
||||
}
|
||||
|
||||
static void decode_mb_p(AVSContext *h, enum cavs_mb mb_type) {
|
||||
static void decode_mb_p(AVSContext *h, enum cavs_mb mb_type)
|
||||
{
|
||||
GetBitContext *gb = &h->s.gb;
|
||||
int ref[4];
|
||||
|
||||
@ -750,7 +760,8 @@ static void decode_mb_p(AVSContext *h, enum cavs_mb mb_type) {
|
||||
h->col_type_base[h->mbidx] = mb_type;
|
||||
}
|
||||
|
||||
static int decode_mb_b(AVSContext *h, enum cavs_mb mb_type) {
|
||||
static int decode_mb_b(AVSContext *h, enum cavs_mb mb_type)
|
||||
{
|
||||
int block;
|
||||
enum cavs_sub_mb sub_type[4];
|
||||
int flags;
|
||||
@ -870,7 +881,8 @@ static int decode_mb_b(AVSContext *h, enum cavs_mb mb_type) {
|
||||
*
|
||||
****************************************************************************/
|
||||
|
||||
static inline int decode_slice_header(AVSContext *h, GetBitContext *gb) {
|
||||
static inline int decode_slice_header(AVSContext *h, GetBitContext *gb)
|
||||
{
|
||||
if (h->stc > 0xAF)
|
||||
av_log(h->s.avctx, AV_LOG_ERROR, "unexpected start code 0x%02x\n", h->stc);
|
||||
|
||||
@ -887,7 +899,8 @@ static inline int decode_slice_header(AVSContext *h, GetBitContext *gb) {
|
||||
h->qp = get_bits(gb, 6);
|
||||
}
|
||||
/* inter frame or second slice can have weighting params */
|
||||
if((h->pic_type != AV_PICTURE_TYPE_I) || (!h->pic_structure && h->mby >= h->mb_width/2))
|
||||
if ((h->pic_type != AV_PICTURE_TYPE_I) ||
|
||||
(!h->pic_structure && h->mby >= h->mb_width / 2))
|
||||
if (get_bits1(gb)) { //slice_weighting_flag
|
||||
av_log(h->s.avctx, AV_LOG_ERROR,
|
||||
"weighted prediction not yet supported\n");
|
||||
@ -895,7 +908,8 @@ static inline int decode_slice_header(AVSContext *h, GetBitContext *gb) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
static inline int check_for_slice(AVSContext *h) {
|
||||
static inline int check_for_slice(AVSContext *h)
|
||||
{
|
||||
GetBitContext *gb = &h->s.gb;
|
||||
int align;
|
||||
|
||||
@ -922,7 +936,8 @@ static inline int check_for_slice(AVSContext *h) {
|
||||
*
|
||||
****************************************************************************/
|
||||
|
||||
static int decode_pic(AVSContext *h) {
|
||||
static int decode_pic(AVSContext *h)
|
||||
{
|
||||
MpegEncContext *s = &h->s;
|
||||
int skip_count = -1;
|
||||
int ret;
|
||||
@ -1069,7 +1084,8 @@ static int decode_pic(AVSContext *h) {
|
||||
*
|
||||
****************************************************************************/
|
||||
|
||||
static int decode_seq_header(AVSContext *h) {
|
||||
static int decode_seq_header(AVSContext *h)
|
||||
{
|
||||
MpegEncContext *s = &h->s;
|
||||
int frame_rate_code;
|
||||
int width, height;
|
||||
@ -1110,22 +1126,24 @@ static int decode_seq_header(AVSContext *h) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
static void cavs_flush(AVCodecContext * avctx) {
|
||||
static void cavs_flush(AVCodecContext * avctx)
|
||||
{
|
||||
AVSContext *h = avctx->priv_data;
|
||||
h->got_keyframe = 0;
|
||||
}
|
||||
|
||||
static int cavs_decode_frame(AVCodecContext *avctx, void *data, int *got_frame,
|
||||
AVPacket *avpkt) {
|
||||
const uint8_t *buf = avpkt->data;
|
||||
int buf_size = avpkt->size;
|
||||
AVPacket *avpkt)
|
||||
{
|
||||
AVSContext *h = avctx->priv_data;
|
||||
MpegEncContext *s = &h->s;
|
||||
const uint8_t *buf = avpkt->data;
|
||||
int buf_size = avpkt->size;
|
||||
AVFrame *picture = data;
|
||||
uint32_t stc = -1;
|
||||
int input_size;
|
||||
const uint8_t *buf_end;
|
||||
const uint8_t *buf_ptr;
|
||||
AVFrame *picture = data;
|
||||
uint32_t stc = -1;
|
||||
|
||||
s->avctx = avctx;
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user