Ticket #5581: vp_interlaced.diff
| File vp_interlaced.diff, 4.7 KB (added by , 10 years ago) |
|---|
-
libavcodec/vp6data.h
47 47 14, 14, 15, 15, 15, 15, 15, 15, 48 48 }; 49 49 50 static const uint8_t vp6_il_coeff_reorder[] = { 51 0, 1, 0, 1, 1, 2, 5, 3, 52 2, 2, 2, 2, 4, 7, 8, 10, 53 9, 7, 5, 4, 2, 3, 5, 6, 54 8, 9, 11, 12, 13, 12, 11, 10, 55 9, 7, 5, 4, 6, 7, 9, 11, 56 12, 12, 13, 13, 14, 12, 11, 9, 57 7, 9, 11, 12, 14, 14, 14, 15, 58 13, 11, 13, 15, 15, 15, 15, 15, 59 }; 60 50 61 static const uint8_t vp6_def_runv_coeff_model[2][14] = { 51 62 { 198, 197, 196, 146, 198, 204, 169, 142, 130, 136, 149, 149, 191, 249 }, 52 63 { 135, 201, 181, 154, 98, 117, 132, 126, 146, 169, 184, 240, 246, 254 }, -
libavcodec/vp56.c
399 399 vp56_frame_t ref_frame; 400 400 int b, ab, b_max, plane, off; 401 401 402 if (s->interlaced) { 403 int prob = s->il_prob; 404 405 if (row > 0) { 406 if (s->il_block) 407 prob -= prob >> 1; 408 else 409 prob += (256 - prob) >> 1; /* can be simplified/combined */ 410 } 411 412 s->il_block = vp56_rac_get_prob(&s->c, prob); 413 414 if (s->il_block) { 415 s->block_offset[2] -= s->stride[0] * 7; 416 s->block_offset[3] -= s->stride[0] * 7; 417 s->stride[0] *= 2; 418 } 419 } 420 402 421 if (s->framep[VP56_FRAME_CURRENT]->key_frame) 403 422 mb_type = VP56_MB_INTRA; 404 423 else … … 457 476 } 458 477 break; 459 478 } 479 480 if (s->il_block) { 481 s->stride[0] /= 2; 482 s->block_offset[2] += s->stride[0] * 7; 483 s->block_offset[3] += s->stride[0] * 7; 484 } 460 485 } 461 486 462 487 static int vp56_size_changed(AVCodecContext *avctx) … … 546 571 547 572 s->parse_coeff_models(s); 548 573 574 if (s->interlaced) 575 s->il_prob = vp56_rac_gets(&s->c, 8); 576 549 577 memset(s->prev_dc, 0, sizeof(s->prev_dc)); 550 578 s->prev_dc[1][VP56_FRAME_CURRENT] = 128; 551 579 s->prev_dc[2][VP56_FRAME_CURRENT] = 128; -
libavcodec/vp56.h
120 120 vp56_mb_t mb_type; 121 121 vp56_macroblock_t *macroblocks; 122 122 DECLARE_ALIGNED_16(DCTELEM, block_coeff[6][64]); 123 const uint8_t *def_coeff_reorder;/* used in vp6 only */ 123 124 124 125 /* motion vectors */ 125 126 vp56_mv_t mv[6]; /* vectors for each block in MB */ … … 139 140 140 141 int has_alpha; 141 142 143 /* interlacing params */ 144 int interlaced; 145 int il_prob; 146 int il_block; 147 142 148 /* upside-down flipping hints */ 143 149 int flip; /* are we flipping ? */ 144 150 int frbi; /* first row block index in MB */ -
libavcodec/vp5.c
50 50 if(vp56_rac_gets(c, 5) > 5) 51 51 return 0; 52 52 vp56_rac_gets(c, 2); 53 if (vp56_rac_get(c)) { 54 av_log(s->avctx, AV_LOG_ERROR, "interlacing not supported\n"); 55 return 0; 56 } 53 s->interlaced = vp56_rac_get(c); 57 54 rows = vp56_rac_gets(c, 8); /* number of stored macroblock rows */ 58 55 cols = vp56_rac_gets(c, 8); /* number of stored macroblock cols */ 59 56 vp56_rac_gets(c, 8); /* number of displayed macroblock rows */ -
libavcodec/vp6.c
61 61 if (sub_version > 8) 62 62 return 0; 63 63 s->filter_header = buf[1] & 0x06; 64 if (buf[1] & 1) { 65 av_log(s->avctx, AV_LOG_ERROR, "interlacing not supported\n"); 66 return 0; 67 } 64 s->interlaced = buf[1] & 1; 65 if (s->interlaced) 66 s->def_coeff_reorder = vp6_il_coeff_reorder; 67 else 68 s->def_coeff_reorder = vp6_def_coeff_reorder; 68 69 if (separated_coeff || !s->filter_header) { 69 70 coeff_offset = AV_RB16(buf+2) - 2; 70 71 buf += 2; … … 174 175 memcpy(model->vector_fdv, vp6_def_fdv_vector_model, sizeof(model->vector_fdv)); 175 176 memcpy(model->vector_pdv, vp6_def_pdv_vector_model, sizeof(model->vector_pdv)); 176 177 memcpy(model->coeff_runv, vp6_def_runv_coeff_model, sizeof(model->coeff_runv)); 177 memcpy(model->coeff_reorder, vp6_def_coeff_reorder, sizeof(model->coeff_reorder));178 memcpy(model->coeff_reorder, s->def_coeff_reorder, sizeof(model->coeff_reorder)); 178 179 179 180 vp6_coeff_order_table_init(s); 180 181 }
