diff options
author | XhmikosR <xhmikosr@users.sourceforge.net> | 2010-04-09 18:12:59 +0400 |
---|---|---|
committer | XhmikosR <xhmikosr@users.sourceforge.net> | 2010-04-09 18:12:59 +0400 |
commit | efbc9d9043ff8ff92716ddd00a5f61412d535593 (patch) | |
tree | 8f3e621f756cf1f5b4d64d97964c7e7abd8aaf08 /src/filters/transform/MPCVideoDec/ffmpeg/libavcodec/vp5.c | |
parent | df6b139a6d9027156f614b68687e039e3a5854db (diff) |
revert r1783
git-svn-id: https://mpc-hc.svn.sourceforge.net/svnroot/mpc-hc/trunk@1785 10f7b99b-c216-0410-bff0-8a66a9350fd8
Diffstat (limited to 'src/filters/transform/MPCVideoDec/ffmpeg/libavcodec/vp5.c')
-rw-r--r-- | src/filters/transform/MPCVideoDec/ffmpeg/libavcodec/vp5.c | 140 |
1 files changed, 56 insertions, 84 deletions
diff --git a/src/filters/transform/MPCVideoDec/ffmpeg/libavcodec/vp5.c b/src/filters/transform/MPCVideoDec/ffmpeg/libavcodec/vp5.c index 5d797163c..b8b7f9718 100644 --- a/src/filters/transform/MPCVideoDec/ffmpeg/libavcodec/vp5.c +++ b/src/filters/transform/MPCVideoDec/ffmpeg/libavcodec/vp5.c @@ -43,14 +43,13 @@ static int vp5_parse_header(VP56Context *s, const uint8_t *buf, int buf_size, s->framep[VP56_FRAME_CURRENT]->key_frame = !vp56_rac_get(c); vp56_rac_get(c); vp56_init_dequant(s, vp56_rac_gets(c, 6)); - if(s->framep[VP56_FRAME_CURRENT]->key_frame) + if (s->framep[VP56_FRAME_CURRENT]->key_frame) { vp56_rac_gets(c, 8); if(vp56_rac_gets(c, 5) > 5) return 0; vp56_rac_gets(c, 2); - if(vp56_rac_get(c)) - { + if (vp56_rac_get(c)) { av_log(s->avctx, AV_LOG_ERROR, "interlacing not supported\n"); return 0; } @@ -59,15 +58,13 @@ static int vp5_parse_header(VP56Context *s, const uint8_t *buf, int buf_size, vp56_rac_gets(c, 8); /* number of displayed macroblock rows */ vp56_rac_gets(c, 8); /* number of displayed macroblock cols */ vp56_rac_gets(c, 2); - if(!s->macroblocks || /* first frame */ - 16 * cols != s->avctx->coded_width || - 16 * rows != s->avctx->coded_height) - { - avcodec_set_dimensions(s->avctx, 16 * cols, 16 * rows); + if (!s->macroblocks || /* first frame */ + 16*cols != s->avctx->coded_width || + 16*rows != s->avctx->coded_height) { + avcodec_set_dimensions(s->avctx, 16*cols, 16*rows); return 2; } - } - else if(!s->macroblocks) + } else if (!s->macroblocks) return 0; return 1; } @@ -78,7 +75,7 @@ static int vp5_adjust(int v, int t) int s2, s1 = v >> 31; v ^= s1; v -= s1; - v *= v < 2 * t; + v *= v < 2*t; v -= t; s2 = v >> 31; v ^= s2; @@ -95,11 +92,9 @@ static void vp5_parse_vector_adjustment(VP56Context *s, VP56mv *vect) VP56Model *model = s->modelp; int comp, di; - for(comp = 0; comp < 2; comp++) - { + for (comp=0; comp<2; comp++) { int delta = 0; - if(vp56_rac_get_prob(c, model->vector_dct[comp])) - { + if (vp56_rac_get_prob(c, model->vector_dct[comp])) { int sign = vp56_rac_get_prob(c, model->vector_sig[comp]); di = vp56_rac_get_prob(c, model->vector_pdi[comp][0]); di |= vp56_rac_get_prob(c, model->vector_pdi[comp][1]) << 1; @@ -108,7 +103,7 @@ static void vp5_parse_vector_adjustment(VP56Context *s, VP56mv *vect) delta = di | (delta << 2); delta = (delta ^ -sign) + sign; } - if(!comp) + if (!comp) vect->x = delta; else vect->y = delta; @@ -121,21 +116,20 @@ static void vp5_parse_vector_models(VP56Context *s) VP56Model *model = s->modelp; int comp, node; - for(comp = 0; comp < 2; comp++) - { - if(vp56_rac_get_prob(c, vp5_vmc_pct[comp][0])) + for (comp=0; comp<2; comp++) { + if (vp56_rac_get_prob(c, vp5_vmc_pct[comp][0])) model->vector_dct[comp] = vp56_rac_gets_nn(c, 7); - if(vp56_rac_get_prob(c, vp5_vmc_pct[comp][1])) + if (vp56_rac_get_prob(c, vp5_vmc_pct[comp][1])) model->vector_sig[comp] = vp56_rac_gets_nn(c, 7); - if(vp56_rac_get_prob(c, vp5_vmc_pct[comp][2])) + if (vp56_rac_get_prob(c, vp5_vmc_pct[comp][2])) model->vector_pdi[comp][0] = vp56_rac_gets_nn(c, 7); - if(vp56_rac_get_prob(c, vp5_vmc_pct[comp][3])) + if (vp56_rac_get_prob(c, vp5_vmc_pct[comp][3])) model->vector_pdi[comp][1] = vp56_rac_gets_nn(c, 7); } - for(comp = 0; comp < 2; comp++) - for(node = 0; node < 7; node++) - if(vp56_rac_get_prob(c, vp5_vmc_pct[comp][4 + node])) + for (comp=0; comp<2; comp++) + for (node=0; node<7; node++) + if (vp56_rac_get_prob(c, vp5_vmc_pct[comp][4 + node])) model->vector_pdv[comp][node] = vp56_rac_gets_nn(c, 7); } @@ -150,44 +144,38 @@ static void vp5_parse_coeff_models(VP56Context *s) memset(def_prob, 0x80, sizeof(def_prob)); - for(pt = 0; pt < 2; pt++) - for(node = 0; node < 11; node++) - if(vp56_rac_get_prob(c, vp5_dccv_pct[pt][node])) - { + for (pt=0; pt<2; pt++) + for (node=0; node<11; node++) + if (vp56_rac_get_prob(c, vp5_dccv_pct[pt][node])) { def_prob[node] = vp56_rac_gets_nn(c, 7); model->coeff_dccv[pt][node] = def_prob[node]; - } - else if(s->framep[VP56_FRAME_CURRENT]->key_frame) - { + } else if (s->framep[VP56_FRAME_CURRENT]->key_frame) { model->coeff_dccv[pt][node] = def_prob[node]; } - for(ct = 0; ct < 3; ct++) - for(pt = 0; pt < 2; pt++) - for(cg = 0; cg < 6; cg++) - for(node = 0; node < 11; node++) - if(vp56_rac_get_prob(c, vp5_ract_pct[ct][pt][cg][node])) - { + for (ct=0; ct<3; ct++) + for (pt=0; pt<2; pt++) + for (cg=0; cg<6; cg++) + for (node=0; node<11; node++) + if (vp56_rac_get_prob(c, vp5_ract_pct[ct][pt][cg][node])) { def_prob[node] = vp56_rac_gets_nn(c, 7); model->coeff_ract[pt][ct][cg][node] = def_prob[node]; - } - else if(s->framep[VP56_FRAME_CURRENT]->key_frame) - { + } else if (s->framep[VP56_FRAME_CURRENT]->key_frame) { model->coeff_ract[pt][ct][cg][node] = def_prob[node]; } /* coeff_dcct is a linear combination of coeff_dccv */ - for(pt = 0; pt < 2; pt++) - for(ctx = 0; ctx < 36; ctx++) - for(node = 0; node < 5; node++) + for (pt=0; pt<2; pt++) + for (ctx=0; ctx<36; ctx++) + for (node=0; node<5; node++) model->coeff_dcct[pt][ctx][node] = av_clip(((model->coeff_dccv[pt][node] * vp5_dccv_lc[node][ctx][0] + 128) >> 8) + vp5_dccv_lc[node][ctx][1], 1, 254); /* coeff_acct is a linear combination of coeff_ract */ - for(ct = 0; ct < 3; ct++) - for(pt = 0; pt < 2; pt++) - for(cg = 0; cg < 3; cg++) - for(ctx = 0; ctx < 6; ctx++) - for(node = 0; node < 5; node++) + for (ct=0; ct<3; ct++) + for (pt=0; pt<2; pt++) + for (cg=0; cg<3; cg++) + for (ctx=0; ctx<6; ctx++) + for (node=0; node<5; node++) model->coeff_acct[pt][ct][cg][ctx][node] = av_clip(((model->coeff_ract[pt][ct][cg][node] * vp5_ract_lc[ct][cg][node][ctx][0] + 128) >> 8) + vp5_ract_lc[ct][cg][node][ctx][1], 1, 254); } @@ -201,63 +189,49 @@ static void vp5_parse_coeff(VP56Context *s) int b, i, cg, idx, ctx, ctx_last; int pt = 0; /* plane type (0 for Y, 1 for U or V) */ - for(b = 0; b < 6; b++) - { + for (b=0; b<6; b++) { int ct = 1; /* code type */ - if(b > 3) pt = 1; + if (b > 3) pt = 1; - ctx = 6 * s->coeff_ctx[vp56_b6to4[b]][0] + ctx = 6*s->coeff_ctx[vp56_b6to4[b]][0] + s->above_blocks[s->above_block_idx[b]].not_null_dc; model1 = model->coeff_dccv[pt]; model2 = model->coeff_dcct[pt][ctx]; - for(coeff_idx = 0; coeff_idx < 64;) - { - if(vp56_rac_get_prob(c, model2[0])) - { - if(vp56_rac_get_prob(c, model2[2])) - { - if(vp56_rac_get_prob(c, model2[3])) - { + for (coeff_idx=0; coeff_idx<64; ) { + if (vp56_rac_get_prob(c, model2[0])) { + if (vp56_rac_get_prob(c, model2[2])) { + if (vp56_rac_get_prob(c, model2[3])) { s->coeff_ctx[vp56_b6to4[b]][coeff_idx] = 4; idx = vp56_rac_get_tree(c, vp56_pc_tree, model1); sign = vp56_rac_get(c); coeff = vp56_coeff_bias[idx+5]; - for(i = vp56_coeff_bit_length[idx]; i >= 0; i--) + for (i=vp56_coeff_bit_length[idx]; i>=0; i--) coeff += vp56_rac_get_prob(c, vp56_coeff_parse_table[idx][i]) << i; - } - else - { - if(vp56_rac_get_prob(c, model2[4])) - { + } else { + if (vp56_rac_get_prob(c, model2[4])) { coeff = 3 + vp56_rac_get_prob(c, model1[5]); s->coeff_ctx[vp56_b6to4[b]][coeff_idx] = 3; - } - else - { + } else { coeff = 2; s->coeff_ctx[vp56_b6to4[b]][coeff_idx] = 2; } sign = vp56_rac_get(c); } ct = 2; - } - else - { + } else { ct = 1; s->coeff_ctx[vp56_b6to4[b]][coeff_idx] = 1; sign = vp56_rac_get(c); coeff = 1; } coeff = (coeff ^ -sign) + sign; - if(coeff_idx) + if (coeff_idx) coeff *= s->dequant_ac; s->block_coeff[b][permute[coeff_idx]] = coeff; - } - else - { - if(ct && !vp56_rac_get_prob(c, model2[1])) + } else { + if (ct && !vp56_rac_get_prob(c, model2[1])) break; ct = 0; s->coeff_ctx[vp56_b6to4[b]][coeff_idx] = 0; @@ -271,8 +245,8 @@ static void vp5_parse_coeff(VP56Context *s) ctx_last = FFMIN(s->coeff_ctx_last[vp56_b6to4[b]], 24); s->coeff_ctx_last[vp56_b6to4[b]] = coeff_idx; - if(coeff_idx < ctx_last) - for(i = coeff_idx; i <= ctx_last; i++) + if (coeff_idx < ctx_last) + for (i=coeff_idx; i<=ctx_last; i++) s->coeff_ctx[vp56_b6to4[b]][i] = 5; s->above_blocks[s->above_block_idx[b]].not_null_dc = s->coeff_ctx[vp56_b6to4[b]][0]; } @@ -283,8 +257,7 @@ static void vp5_default_models_init(VP56Context *s) VP56Model *model = s->modelp; int i; - for(i = 0; i < 2; i++) - { + for (i=0; i<2; i++) { model->vector_sig[i] = 0x80; model->vector_dct[i] = 0x80; model->vector_pdi[i][0] = 0x55; @@ -311,8 +284,7 @@ static av_cold int vp5_decode_init(AVCodecContext *avctx) return 0; } -AVCodec vp5_decoder = -{ +AVCodec vp5_decoder = { "vp5", CODEC_TYPE_VIDEO, CODEC_ID_VP5, |