}
uvmx = (mx + ((mx & 3) == 3)) >> 1;
uvmy = (my + ((my & 3) == 3)) >> 1;
+ if(v->fastuvmc) {
+ uvmx = uvmx + ((uvmx<0)?(uvmx&1):-(uvmx&1));
+ uvmy = uvmy + ((uvmy<0)?(uvmy&1):-(uvmy&1));
+ }
if(!dir) {
srcY = s->last_picture.data[0];
srcU = s->last_picture.data[1];
srcY += s->mspel * (1 + s->linesize);
}
- if(v->fastuvmc) {
- uvmx = uvmx + ((uvmx<0)?-(uvmx&1):(uvmx&1));
- uvmy = uvmy + ((uvmy<0)?-(uvmy&1):(uvmy&1));
- }
-
if(s->mspel) {
dxy = ((my & 3) << 2) | (mx & 3);
dsp->put_vc1_mspel_pixels_tab[dxy](s->dest[0] , srcY , s->linesize, v->rnd);
s->current_picture.motion_val[1][s->block_index[0]][1] = ty;
uvmx = (tx + ((tx&3) == 3)) >> 1;
uvmy = (ty + ((ty&3) == 3)) >> 1;
+ if(v->fastuvmc) {
+ uvmx = uvmx + ((uvmx<0)?(uvmx&1):-(uvmx&1));
+ uvmy = uvmy + ((uvmy<0)?(uvmy&1):-(uvmy&1));
+ }
uvsrc_x = s->mb_x * 8 + (uvmx >> 2);
uvsrc_y = s->mb_y * 8 + (uvmy >> 2);
}
}
- if(v->fastuvmc) {
- uvmx = uvmx + ((uvmx<0)?-(uvmx&1):(uvmx&1));
- uvmy = uvmy + ((uvmy<0)?-(uvmy&1):(uvmy&1));
- }
-
/* Chroma MC always uses qpel bilinear */
uvdxy = ((uvmy & 3) << 2) | (uvmx & 3);
uvmx = (uvmx&3)<<1;
v->s.avctx->coded_height = (get_bits(gb, 12) + 1) << 1;
v->broadcast = get_bits1(gb);
v->interlace = get_bits1(gb);
+ if(v->interlace){
+ av_log(v->s.avctx, AV_LOG_ERROR, "Interlaced mode not supported (yet)\n");
+ return -1;
+ }
v->tfcntrflag = get_bits1(gb);
v->finterpflag = get_bits1(gb);
get_bits1(gb); // reserved
+
+ av_log(v->s.avctx, AV_LOG_DEBUG,
+ "Advanced Profile level %i:\nfrmrtq_postproc=%i, bitrtq_postproc=%i\n"
+ "LoopFilter=%i, ChromaFormat=%i, Pulldown=%i, Interlace: %i\n"
+ "TFCTRflag=%i, FINTERPflag=%i\n",
+ v->level, v->frmrtq_postproc, v->bitrtq_postproc,
+ v->s.loop_filter, v->chromaformat, v->broadcast, v->interlace,
+ v->tfcntrflag, v->finterpflag
+ );
+
v->psf = get_bits1(gb);
if(v->psf) { //PsF, 6.1.13
av_log(v->s.avctx, AV_LOG_ERROR, "Progressive Segmented Frame mode: not supported (yet)\n");
if(get_bits1(gb)) { //Display Info - decoding is not affected by it
int w, h, ar = 0;
av_log(v->s.avctx, AV_LOG_INFO, "Display extended info:\n");
- w = get_bits(gb, 14);
- h = get_bits(gb, 14);
+ w = get_bits(gb, 14) + 1;
+ h = get_bits(gb, 14) + 1;
av_log(v->s.avctx, AV_LOG_INFO, "Display dimensions: %ix%i\n", w, h);
- //TODO: store aspect ratio in AVCodecContext
if(get_bits1(gb))
ar = get_bits(gb, 4);
- if(ar == 15) {
+ if(ar && ar < 14){
+ v->s.avctx->sample_aspect_ratio = vc1_pixel_aspect[ar];
+ }else if(ar == 15){
w = get_bits(gb, 8);
h = get_bits(gb, 8);
+ v->s.avctx->sample_aspect_ratio = (AVRational){w, h};
}
if(get_bits1(gb)){ //framerate stuff
static int decode_entry_point(AVCodecContext *avctx, GetBitContext *gb)
{
VC1Context *v = avctx->priv_data;
- int i;
+ int i, blink, refdist;
av_log(avctx, AV_LOG_DEBUG, "Entry point: %08X\n", show_bits_long(gb, 32));
- get_bits1(gb); // broken link
+ blink = get_bits1(gb); // broken link
avctx->max_b_frames = 1 - get_bits1(gb); // 'closed entry' also signalize possible B-frames
v->panscanflag = get_bits1(gb);
- get_bits1(gb); // refdist flag
+ refdist = get_bits1(gb); // refdist flag
v->s.loop_filter = get_bits1(gb);
v->fastuvmc = get_bits1(gb);
v->extended_mv = get_bits1(gb);
skip_bits(gb, 3); // UV range, ignored for now
}
+ av_log(avctx, AV_LOG_DEBUG, "Entry point info:\n"
+ "BrokenLink=%i, ClosedEntry=%i, PanscanFlag=%i\n"
+ "RefDist=%i, Postproc=%i, FastUVMC=%i, ExtMV=%i\n"
+ "DQuant=%i, VSTransform=%i, Overlap=%i, Qmode=%i\n",
+ blink, 1 - avctx->max_b_frames, v->panscanflag, refdist, v->s.loop_filter,
+ v->fastuvmc, v->extended_mv, v->dquant, v->vstransform, v->overlap, v->quantizer_mode);
+
return 0;
}
}
/* DC Syntax */
v->s.dc_table_index = get_bits(gb, 1);
- if (v->s.pict_type == I_TYPE && v->dquant) {
+ if ((v->s.pict_type == I_TYPE || v->s.pict_type == BI_TYPE) && v->dquant) {
av_log(v->s.avctx, AV_LOG_DEBUG, "VOP DQuant info\n");
vop_dquant_decoding(v);
}
my = s->mv[1][0][1];
uvmx = (mx + ((mx & 3) == 3)) >> 1;
uvmy = (my + ((my & 3) == 3)) >> 1;
+ if(v->fastuvmc) {
+ uvmx = uvmx + ((uvmx<0)?-(uvmx&1):(uvmx&1));
+ uvmy = uvmy + ((uvmy<0)?-(uvmy&1):(uvmy&1));
+ }
srcY = s->next_picture.data[0];
srcU = s->next_picture.data[1];
srcV = s->next_picture.data[2];
srcY += s->mspel * (1 + s->linesize);
}
- if(v->fastuvmc) {
- uvmx = uvmx + ((uvmx<0)?-(uvmx&1):(uvmx&1));
- uvmy = uvmy + ((uvmy<0)?-(uvmy&1):(uvmy&1));
- }
-
mx >>= 1;
my >>= 1;
dxy = ((my & 1) << 1) | (mx & 1);
dsp->avg_h264_chroma_pixels_tab[0](s->dest[2], srcV, s->uvlinesize, 8, uvmx, uvmy);
}
-static always_inline int scale_mv(int value, int bfrac, int inv, int qs)
+static av_always_inline int scale_mv(int value, int bfrac, int inv, int qs)
{
int n = bfrac;
ac_val -= 16 * s->block_wrap[n];
q1 = s->current_picture.qscale_table[mb_pos];
- if(dc_pred_dir && c_avail) q2 = s->current_picture.qscale_table[mb_pos - 1];
- if(!dc_pred_dir && a_avail) q2 = s->current_picture.qscale_table[mb_pos - s->mb_stride];
+ if(dc_pred_dir && c_avail && mb_pos) q2 = s->current_picture.qscale_table[mb_pos - 1];
+ if(!dc_pred_dir && a_avail && mb_pos >= s->mb_stride) q2 = s->current_picture.qscale_table[mb_pos - s->mb_stride];
if(n && n<4) q2 = q1;
if(coded) {
vc1_decode_p_blocks(v);
break;
case B_TYPE:
- if(v->bi_type)
- vc1_decode_i_blocks(v);
- else
+ if(v->bi_type){
+ if(v->profile == PROFILE_ADVANCED)
+ vc1_decode_i_blocks_adv(v);
+ else
+ vc1_decode_i_blocks(v);
+ }else
vc1_decode_b_blocks(v);
break;
}
}
while(edata_size > 8) {
// test if we've found header
- if(BE_32(edata) == 0x0000010F) {
+ if(AV_RB32(edata) == 0x0000010F) {
edata += 4;
edata_size -= 4;
break;
while(edata_size > 8) {
// test if we've found entry point
- if(BE_32(edata) == 0x0000010E) {
+ if(AV_RB32(edata) == 0x0000010E) {
edata += 4;
edata_size -= 4;
break;