History

avcodec/rv30, rv34, rv40: Avoid indirection

Use the cached values from MpegEncContext.(cur|last|next)_pic instead of the corresponding *_pic_ptr. Also do the same in wmv2dec.c and mpegvideo_enc.c.

Andreas Rheinhardt committed 3 years ago

Commit f1c4e891 parent 7814dd75 files · +80 −79Browse files

Unified · Split

5 files
  1. libavcodec/mpegvideo_enc.c +1 −1
  2. libavcodec/rv30.c +9 −9
  3. libavcodec/rv34.c +62 −60
  4. libavcodec/rv40.c +5 −5
  5. libavcodec/wmv2dec.c +3 −4
libavcodec/mpegvideo_enc.c+1−1
@@ -2145,7 +2145,7 @@ static av_always_inline void encode_mb_internal(MpegEncContext *s, · 2144 unmodified lines
2145 update_qscale(s);2145 update_qscale(s);
2146 2146
2147 if (!(s->mpv_flags & FF_MPV_FLAG_QP_RD)) {2147 if (!(s->mpv_flags & FF_MPV_FLAG_QP_RD)) {
2148 s->qscale = s->cur_pic_ptr->qscale_table[mb_xy];2148 s->qscale = s->cur_pic.qscale_table[mb_xy];
2149 s->dquant = s->qscale - last_qp;2149 s->dquant = s->qscale - last_qp;
2150 2150
2151 if (s->out_format == FMT_H263) {2151 if (s->out_format == FMT_H263) {
libavcodec/rv30.c+9−9
@@ -160,7 +160,7 @@ static void rv30_loop_filter(RV34DecContext *r, int row) · 159 unmodified lines
160 160
161 mb_pos = row * s->mb_stride;161 mb_pos = row * s->mb_stride;
162 for(mb_x = 0; mb_x < s->mb_width; mb_x++, mb_pos++){162 for(mb_x = 0; mb_x < s->mb_width; mb_x++, mb_pos++){
163 int mbtype = s->cur_pic_ptr->mb_type[mb_pos];163 int mbtype = s->cur_pic.mb_type[mb_pos];
164 if(IS_INTRA(mbtype) || IS_SEPARATE_DC(mbtype))164 if(IS_INTRA(mbtype) || IS_SEPARATE_DC(mbtype))
165 r->deblock_coefs[mb_pos] = 0xFFFF;165 r->deblock_coefs[mb_pos] = 0xFFFF;
166 if(IS_INTRA(mbtype))166 if(IS_INTRA(mbtype))
@@ -172,11 +172,11 @@ static void rv30_loop_filter(RV34DecContext *r, int row) · 5 unmodified lines
172 */172 */
173 mb_pos = row * s->mb_stride;173 mb_pos = row * s->mb_stride;
174 for(mb_x = 0; mb_x < s->mb_width; mb_x++, mb_pos++){174 for(mb_x = 0; mb_x < s->mb_width; mb_x++, mb_pos++){
175 cur_lim = rv30_loop_filt_lim[s->cur_pic_ptr->qscale_table[mb_pos]];175 cur_lim = rv30_loop_filt_lim[s->cur_pic.qscale_table[mb_pos]];
176 if(mb_x)176 if(mb_x)
177 left_lim = rv30_loop_filt_lim[s->cur_pic_ptr->qscale_table[mb_pos - 1]];177 left_lim = rv30_loop_filt_lim[s->cur_pic.qscale_table[mb_pos - 1]];
178 for(j = 0; j < 16; j += 4){178 for(j = 0; j < 16; j += 4){
179 Y = s->cur_pic_ptr->f->data[0] + mb_x*16 + (row*16 + j) * s->linesize + 4 * !mb_x;179 Y = s->cur_pic.data[0] + mb_x*16 + (row*16 + j) * s->linesize + 4 * !mb_x;
180 for(i = !mb_x; i < 4; i++, Y += 4){180 for(i = !mb_x; i < 4; i++, Y += 4){
181 int ij = i + j;181 int ij = i + j;
182 loc_lim = 0;182 loc_lim = 0;
@@ -196,7 +196,7 @@ static void rv30_loop_filter(RV34DecContext *r, int row) · 13 unmodified lines
196 if(mb_x)196 if(mb_x)
197 left_cbp = (r->cbp_chroma[mb_pos - 1] >> (k*4)) & 0xF;197 left_cbp = (r->cbp_chroma[mb_pos - 1] >> (k*4)) & 0xF;
198 for(j = 0; j < 8; j += 4){198 for(j = 0; j < 8; j += 4){
199 C = s->cur_pic_ptr->f->data[k + 1] + mb_x*8 + (row*8 + j) * s->uvlinesize + 4 * !mb_x;199 C = s->cur_pic.data[k + 1] + mb_x*8 + (row*8 + j) * s->uvlinesize + 4 * !mb_x;
200 for(i = !mb_x; i < 2; i++, C += 4){200 for(i = !mb_x; i < 2; i++, C += 4){
201 int ij = i + (j >> 1);201 int ij = i + (j >> 1);
202 loc_lim = 0;202 loc_lim = 0;
@@ -214,11 +214,11 @@ static void rv30_loop_filter(RV34DecContext *r, int row) · 11 unmodified lines
214 }214 }
215 mb_pos = row * s->mb_stride;215 mb_pos = row * s->mb_stride;
216 for(mb_x = 0; mb_x < s->mb_width; mb_x++, mb_pos++){216 for(mb_x = 0; mb_x < s->mb_width; mb_x++, mb_pos++){
217 cur_lim = rv30_loop_filt_lim[s->cur_pic_ptr->qscale_table[mb_pos]];217 cur_lim = rv30_loop_filt_lim[s->cur_pic.qscale_table[mb_pos]];
218 if(row)218 if(row)
219 top_lim = rv30_loop_filt_lim[s->cur_pic_ptr->qscale_table[mb_pos - s->mb_stride]];219 top_lim = rv30_loop_filt_lim[s->cur_pic.qscale_table[mb_pos - s->mb_stride]];
220 for(j = 4*!row; j < 16; j += 4){220 for(j = 4*!row; j < 16; j += 4){
221 Y = s->cur_pic_ptr->f->data[0] + mb_x*16 + (row*16 + j) * s->linesize;221 Y = s->cur_pic.data[0] + mb_x*16 + (row*16 + j) * s->linesize;
222 for(i = 0; i < 4; i++, Y += 4){222 for(i = 0; i < 4; i++, Y += 4){
223 int ij = i + j;223 int ij = i + j;
224 loc_lim = 0;224 loc_lim = 0;
@@ -238,7 +238,7 @@ static void rv30_loop_filter(RV34DecContext *r, int row) · 13 unmodified lines
238 if(row)238 if(row)
239 top_cbp = (r->cbp_chroma[mb_pos - s->mb_stride] >> (k*4)) & 0xF;239 top_cbp = (r->cbp_chroma[mb_pos - s->mb_stride] >> (k*4)) & 0xF;
240 for(j = 4*!row; j < 8; j += 4){240 for(j = 4*!row; j < 8; j += 4){
241 C = s->cur_pic_ptr->f->data[k+1] + mb_x*8 + (row*8 + j) * s->uvlinesize;241 C = s->cur_pic.data[k+1] + mb_x*8 + (row*8 + j) * s->uvlinesize;
242 for(i = 0; i < 2; i++, C += 4){242 for(i = 0; i < 2; i++, C += 4){
243 int ij = i + (j >> 1);243 int ij = i + (j >> 1);
244 loc_lim = 0;244 loc_lim = 0;
libavcodec/rv34.c+62−60
@@ -369,7 +369,7 @@ static int rv34_decode_intra_mb_header(RV34DecContext *r, int8_t *intra_types) · 368 unmodified lines
369 369
370 r->is16 = get_bits1(gb);370 r->is16 = get_bits1(gb);
371 if(r->is16){371 if(r->is16){
372 s->cur_pic_ptr->mb_type[mb_pos] = MB_TYPE_INTRA16x16;372 s->cur_pic.mb_type[mb_pos] = MB_TYPE_INTRA16x16;
373 r->block_type = RV34_MB_TYPE_INTRA16x16;373 r->block_type = RV34_MB_TYPE_INTRA16x16;
374 t = get_bits(gb, 2);374 t = get_bits(gb, 2);
375 fill_rectangle(intra_types, 4, 4, r->intra_types_stride, t, sizeof(intra_types[0]));375 fill_rectangle(intra_types, 4, 4, r->intra_types_stride, t, sizeof(intra_types[0]));
@@ -379,7 +379,7 @@ static int rv34_decode_intra_mb_header(RV34DecContext *r, int8_t *intra_types) · 3 unmodified lines
379 if(!get_bits1(gb))379 if(!get_bits1(gb))
380 av_log(s->avctx, AV_LOG_ERROR, "Need DQUANT\n");380 av_log(s->avctx, AV_LOG_ERROR, "Need DQUANT\n");
381 }381 }
382 s->cur_pic_ptr->mb_type[mb_pos] = MB_TYPE_INTRA;382 s->cur_pic.mb_type[mb_pos] = MB_TYPE_INTRA;
383 r->block_type = RV34_MB_TYPE_INTRA;383 r->block_type = RV34_MB_TYPE_INTRA;
384 if(r->decode_intra_types(r, gb, intra_types) < 0)384 if(r->decode_intra_types(r, gb, intra_types) < 0)
385 return -1;385 return -1;
@@ -405,7 +405,7 @@ static int rv34_decode_inter_mb_header(RV34DecContext *r, int8_t *intra_types) · 19 unmodified lines
405 r->block_type = r->decode_mb_info(r);405 r->block_type = r->decode_mb_info(r);
406 if(r->block_type == -1)406 if(r->block_type == -1)
407 return -1;407 return -1;
408 s->cur_pic_ptr->mb_type[mb_pos] = rv34_mb_type_to_lavc[r->block_type];408 s->cur_pic.mb_type[mb_pos] = rv34_mb_type_to_lavc[r->block_type];
409 r->mb_type[mb_pos] = r->block_type;409 r->mb_type[mb_pos] = r->block_type;
410 if(r->block_type == RV34_MB_SKIP){410 if(r->block_type == RV34_MB_SKIP){
411 if(s->pict_type == AV_PICTURE_TYPE_P)411 if(s->pict_type == AV_PICTURE_TYPE_P)
@@ -413,7 +413,7 @@ static int rv34_decode_inter_mb_header(RV34DecContext *r, int8_t *intra_types) · 1 unmodified line
413 if(s->pict_type == AV_PICTURE_TYPE_B)413 if(s->pict_type == AV_PICTURE_TYPE_B)
414 r->mb_type[mb_pos] = RV34_MB_B_DIRECT;414 r->mb_type[mb_pos] = RV34_MB_B_DIRECT;
415 }415 }
416 r->is16 = !!IS_INTRA16x16(s->cur_pic_ptr->mb_type[mb_pos]);416 r->is16 = !!IS_INTRA16x16(s->cur_pic.mb_type[mb_pos]);
417 if (rv34_decode_mv(r, r->block_type) < 0)417 if (rv34_decode_mv(r, r->block_type) < 0)
418 return -1;418 return -1;
419 if(r->block_type == RV34_MB_SKIP){419 if(r->block_type == RV34_MB_SKIP){
@@ -423,7 +423,7 @@ static int rv34_decode_inter_mb_header(RV34DecContext *r, int8_t *intra_types) · 3 unmodified lines
423 r->chroma_vlc = 1;423 r->chroma_vlc = 1;
424 r->luma_vlc = 0;424 r->luma_vlc = 0;
425 425
426 if(IS_INTRA(s->cur_pic_ptr->mb_type[mb_pos])){426 if (IS_INTRA(s->cur_pic.mb_type[mb_pos])) {
427 if(r->is16){427 if(r->is16){
428 t = get_bits(gb, 2);428 t = get_bits(gb, 2);
429 fill_rectangle(intra_types, 4, 4, r->intra_types_stride, t, sizeof(intra_types[0]));429 fill_rectangle(intra_types, 4, 4, r->intra_types_stride, t, sizeof(intra_types[0]));
@@ -482,33 +482,34 @@ static void rv34_pred_mv(RV34DecContext *r, int block_type, int subblock_no, int · 52 unmodified lines
482 int mx, my;482 int mx, my;
483 int* avail = r->avail_cache + avail_indexes[subblock_no];483 int* avail = r->avail_cache + avail_indexes[subblock_no];
484 int c_off = part_sizes_w[block_type];484 int c_off = part_sizes_w[block_type];
485 int16_t (*motion_val)[2] = s->cur_pic.motion_val[0];
485 486
486 mv_pos += (subblock_no & 1) + (subblock_no >> 1)*s->b8_stride;487 mv_pos += (subblock_no & 1) + (subblock_no >> 1)*s->b8_stride;
487 if(subblock_no == 3)488 if(subblock_no == 3)
488 c_off = -1;489 c_off = -1;
489 490
490 if(avail[-1]){491 if(avail[-1]){
491 A[0] = s->cur_pic_ptr->motion_val[0][mv_pos-1][0];492 A[0] = motion_val[mv_pos-1][0];
492 A[1] = s->cur_pic_ptr->motion_val[0][mv_pos-1][1];493 A[1] = motion_val[mv_pos-1][1];
493 }494 }
494 if(avail[-4]){495 if(avail[-4]){
495 B[0] = s->cur_pic_ptr->motion_val[0][mv_pos-s->b8_stride][0];496 B[0] = motion_val[mv_pos-s->b8_stride][0];
496 B[1] = s->cur_pic_ptr->motion_val[0][mv_pos-s->b8_stride][1];497 B[1] = motion_val[mv_pos-s->b8_stride][1];
497 }else{498 }else{
498 B[0] = A[0];499 B[0] = A[0];
499 B[1] = A[1];500 B[1] = A[1];
500 }501 }
501 if(!avail[c_off-4]){502 if(!avail[c_off-4]){
502 if(avail[-4] && (avail[-1] || r->rv30)){503 if(avail[-4] && (avail[-1] || r->rv30)){
503 C[0] = s->cur_pic_ptr->motion_val[0][mv_pos-s->b8_stride-1][0];504 C[0] = motion_val[mv_pos-s->b8_stride-1][0];
504 C[1] = s->cur_pic_ptr->motion_val[0][mv_pos-s->b8_stride-1][1];505 C[1] = motion_val[mv_pos-s->b8_stride-1][1];
505 }else{506 }else{
506 C[0] = A[0];507 C[0] = A[0];
507 C[1] = A[1];508 C[1] = A[1];
508 }509 }
509 }else{510 }else{
510 C[0] = s->cur_pic_ptr->motion_val[0][mv_pos-s->b8_stride+c_off][0];511 C[0] = motion_val[mv_pos-s->b8_stride+c_off][0];
511 C[1] = s->cur_pic_ptr->motion_val[0][mv_pos-s->b8_stride+c_off][1];512 C[1] = motion_val[mv_pos-s->b8_stride+c_off][1];
512 }513 }
513 mx = mid_pred(A[0], B[0], C[0]);514 mx = mid_pred(A[0], B[0], C[0]);
514 my = mid_pred(A[1], B[1], C[1]);515 my = mid_pred(A[1], B[1], C[1]);
@@ -516,8 +517,8 @@ static void rv34_pred_mv(RV34DecContext *r, int block_type, int subblock_no, int · 1 unmodified line
516 my += r->dmv[dmv_no][1];517 my += r->dmv[dmv_no][1];
517 for(j = 0; j < part_sizes_h[block_type]; j++){518 for(j = 0; j < part_sizes_h[block_type]; j++){
518 for(i = 0; i < part_sizes_w[block_type]; i++){519 for(i = 0; i < part_sizes_w[block_type]; i++){
519 s->cur_pic_ptr->motion_val[0][mv_pos + i + j*s->b8_stride][0] = mx;520 motion_val[mv_pos + i + j*s->b8_stride][0] = mx;
520 s->cur_pic_ptr->motion_val[0][mv_pos + i + j*s->b8_stride][1] = my;521 motion_val[mv_pos + i + j*s->b8_stride][1] = my;
521 }522 }
522 }523 }
523}524}
@@ -566,7 +567,7 @@ static void rv34_pred_mv_b(RV34DecContext *r, int block_type, int dir) · 42 unmodified lines
566 int has_A = 0, has_B = 0, has_C = 0;567 int has_A = 0, has_B = 0, has_C = 0;
567 int mx, my;568 int mx, my;
568 int i, j;569 int i, j;
569 Picture *cur_pic = s->cur_pic_ptr;570 Picture *cur_pic = &s->cur_pic;
570 const int mask = dir ? MB_TYPE_L1 : MB_TYPE_L0;571 const int mask = dir ? MB_TYPE_L1 : MB_TYPE_L0;
571 int type = cur_pic->mb_type[mb_pos];572 int type = cur_pic->mb_type[mb_pos];
572 573
@@ -619,27 +620,27 @@ static void rv34_pred_mv_rv3(RV34DecContext *r, int block_type, int dir) · 46 unmodified lines
619 int* avail = r->avail_cache + avail_indexes[0];620 int* avail = r->avail_cache + avail_indexes[0];
620 621
621 if(avail[-1]){622 if(avail[-1]){
622 A[0] = s->cur_pic_ptr->motion_val[0][mv_pos - 1][0];623 A[0] = s->cur_pic.motion_val[0][mv_pos - 1][0];
623 A[1] = s->cur_pic_ptr->motion_val[0][mv_pos - 1][1];624 A[1] = s->cur_pic.motion_val[0][mv_pos - 1][1];
624 }625 }
625 if(avail[-4]){626 if(avail[-4]){
626 B[0] = s->cur_pic_ptr->motion_val[0][mv_pos - s->b8_stride][0];627 B[0] = s->cur_pic.motion_val[0][mv_pos - s->b8_stride][0];
627 B[1] = s->cur_pic_ptr->motion_val[0][mv_pos - s->b8_stride][1];628 B[1] = s->cur_pic.motion_val[0][mv_pos - s->b8_stride][1];
628 }else{629 }else{
629 B[0] = A[0];630 B[0] = A[0];
630 B[1] = A[1];631 B[1] = A[1];
631 }632 }
632 if(!avail[-4 + 2]){633 if(!avail[-4 + 2]){
633 if(avail[-4] && (avail[-1])){634 if(avail[-4] && (avail[-1])){
634 C[0] = s->cur_pic_ptr->motion_val[0][mv_pos - s->b8_stride - 1][0];635 C[0] = s->cur_pic.motion_val[0][mv_pos - s->b8_stride - 1][0];
635 C[1] = s->cur_pic_ptr->motion_val[0][mv_pos - s->b8_stride - 1][1];636 C[1] = s->cur_pic.motion_val[0][mv_pos - s->b8_stride - 1][1];
636 }else{637 }else{
637 C[0] = A[0];638 C[0] = A[0];
638 C[1] = A[1];639 C[1] = A[1];
639 }640 }
640 }else{641 }else{
641 C[0] = s->cur_pic_ptr->motion_val[0][mv_pos - s->b8_stride + 2][0];642 C[0] = s->cur_pic.motion_val[0][mv_pos - s->b8_stride + 2][0];
642 C[1] = s->cur_pic_ptr->motion_val[0][mv_pos - s->b8_stride + 2][1];643 C[1] = s->cur_pic.motion_val[0][mv_pos - s->b8_stride + 2][1];
643 }644 }
644 mx = mid_pred(A[0], B[0], C[0]);645 mx = mid_pred(A[0], B[0], C[0]);
645 my = mid_pred(A[1], B[1], C[1]);646 my = mid_pred(A[1], B[1], C[1]);
@@ -648,8 +649,8 @@ static void rv34_pred_mv_rv3(RV34DecContext *r, int block_type, int dir) · 2 unmodified lines
648 for(j = 0; j < 2; j++){649 for(j = 0; j < 2; j++){
649 for(i = 0; i < 2; i++){650 for(i = 0; i < 2; i++){
650 for(k = 0; k < 2; k++){651 for(k = 0; k < 2; k++){
651 s->cur_pic_ptr->motion_val[k][mv_pos + i + j*s->b8_stride][0] = mx;652 s->cur_pic.motion_val[k][mv_pos + i + j*s->b8_stride][0] = mx;
652 s->cur_pic_ptr->motion_val[k][mv_pos + i + j*s->b8_stride][1] = my;653 s->cur_pic.motion_val[k][mv_pos + i + j*s->b8_stride][1] = my;
653 }654 }
654 }655 }
655 }656 }
@@ -685,27 +686,28 @@ static inline void rv34_mc(RV34DecContext *r, const int block_type, · 29 unmodified lines
685 int mv_pos = s->mb_x * 2 + s->mb_y * 2 * s->b8_stride + mv_off;686 int mv_pos = s->mb_x * 2 + s->mb_y * 2 * s->b8_stride + mv_off;
686 int is16x16 = 1;687 int is16x16 = 1;
687 int emu = 0;688 int emu = 0;
689 int16_t *motion_val = s->cur_pic.motion_val[dir][mv_pos];
688 690
689 if(thirdpel){691 if(thirdpel){
690 int chroma_mx, chroma_my;692 int chroma_mx, chroma_my;
691 mx = (s->cur_pic_ptr->motion_val[dir][mv_pos][0] + (3 << 24)) / 3 - (1 << 24);693 mx = (motion_val[0] + (3 << 24)) / 3 - (1 << 24);
692 my = (s->cur_pic_ptr->motion_val[dir][mv_pos][1] + (3 << 24)) / 3 - (1 << 24);694 my = (motion_val[1] + (3 << 24)) / 3 - (1 << 24);
693 lx = (s->cur_pic_ptr->motion_val[dir][mv_pos][0] + (3 << 24)) % 3;695 lx = (motion_val[0] + (3 << 24)) % 3;
694 ly = (s->cur_pic_ptr->motion_val[dir][mv_pos][1] + (3 << 24)) % 3;696 ly = (motion_val[1] + (3 << 24)) % 3;
695 chroma_mx = s->cur_pic_ptr->motion_val[dir][mv_pos][0] / 2;697 chroma_mx = motion_val[0] / 2;
696 chroma_my = s->cur_pic_ptr->motion_val[dir][mv_pos][1] / 2;698 chroma_my = motion_val[1] / 2;
697 umx = (chroma_mx + (3 << 24)) / 3 - (1 << 24);699 umx = (chroma_mx + (3 << 24)) / 3 - (1 << 24);
698 umy = (chroma_my + (3 << 24)) / 3 - (1 << 24);700 umy = (chroma_my + (3 << 24)) / 3 - (1 << 24);
699 uvmx = chroma_coeffs[(chroma_mx + (3 << 24)) % 3];701 uvmx = chroma_coeffs[(chroma_mx + (3 << 24)) % 3];
700 uvmy = chroma_coeffs[(chroma_my + (3 << 24)) % 3];702 uvmy = chroma_coeffs[(chroma_my + (3 << 24)) % 3];
701 }else{703 }else{
702 int cx, cy;704 int cx, cy;
703 mx = s->cur_pic_ptr->motion_val[dir][mv_pos][0] >> 2;705 mx = motion_val[0] >> 2;
704 my = s->cur_pic_ptr->motion_val[dir][mv_pos][1] >> 2;706 my = motion_val[1] >> 2;
705 lx = s->cur_pic_ptr->motion_val[dir][mv_pos][0] & 3;707 lx = motion_val[0] & 3;
706 ly = s->cur_pic_ptr->motion_val[dir][mv_pos][1] & 3;708 ly = motion_val[1] & 3;
707 cx = s->cur_pic_ptr->motion_val[dir][mv_pos][0] / 2;709 cx = motion_val[0] / 2;
708 cy = s->cur_pic_ptr->motion_val[dir][mv_pos][1] / 2;710 cy = motion_val[1] / 2;
709 umx = cx >> 2;711 umx = cx >> 2;
710 umy = cy >> 2;712 umy = cy >> 2;
711 uvmx = (cx & 3) << 1;713 uvmx = (cx & 3) << 1;
@@ -723,9 +725,9 @@ static inline void rv34_mc(RV34DecContext *r, const int block_type, · 11 unmodified lines
723 }725 }
724 726
725 dxy = ly*4 + lx;727 dxy = ly*4 + lx;
726 srcY = dir ? s->next_pic_ptr->f->data[0] : s->last_pic_ptr->f->data[0];728 srcY = dir ? s->next_pic.data[0] : s->last_pic.data[0];
727 srcU = dir ? s->next_pic_ptr->f->data[1] : s->last_pic_ptr->f->data[1];729 srcU = dir ? s->next_pic.data[1] : s->last_pic.data[1];
728 srcV = dir ? s->next_pic_ptr->f->data[2] : s->last_pic_ptr->f->data[2];730 srcV = dir ? s->next_pic.data[2] : s->last_pic.data[2];
729 src_x = s->mb_x * 16 + xoff + mx;731 src_x = s->mb_x * 16 + xoff + mx;
730 src_y = s->mb_y * 16 + yoff + my;732 src_y = s->mb_y * 16 + yoff + my;
731 uvsrc_x = s->mb_x * 8 + (xoff >> 1) + umx;733 uvsrc_x = s->mb_x * 8 + (xoff >> 1) + umx;
@@ -886,11 +888,11 @@ static int rv34_decode_mv(RV34DecContext *r, int block_type) · 154 unmodified lines
886 switch(block_type){888 switch(block_type){
887 case RV34_MB_TYPE_INTRA:889 case RV34_MB_TYPE_INTRA:
888 case RV34_MB_TYPE_INTRA16x16:890 case RV34_MB_TYPE_INTRA16x16:
889 ZERO8x2(s->cur_pic_ptr->motion_val[0][s->mb_x * 2 + s->mb_y * 2 * s->b8_stride], s->b8_stride);891 ZERO8x2(s->cur_pic.motion_val[0][s->mb_x * 2 + s->mb_y * 2 * s->b8_stride], s->b8_stride);
890 return 0;892 return 0;
891 case RV34_MB_SKIP:893 case RV34_MB_SKIP:
892 if(s->pict_type == AV_PICTURE_TYPE_P){894 if(s->pict_type == AV_PICTURE_TYPE_P){
893 ZERO8x2(s->cur_pic_ptr->motion_val[0][s->mb_x * 2 + s->mb_y * 2 * s->b8_stride], s->b8_stride);895 ZERO8x2(s->cur_pic.motion_val[0][s->mb_x * 2 + s->mb_y * 2 * s->b8_stride], s->b8_stride);
894 rv34_mc_1mv (r, block_type, 0, 0, 0, 2, 2, 0);896 rv34_mc_1mv (r, block_type, 0, 0, 0, 2, 2, 0);
895 break;897 break;
896 }898 }
@@ -900,21 +902,21 @@ static int rv34_decode_mv(RV34DecContext *r, int block_type) · 3 unmodified lines
900 if (HAVE_THREADS && (s->avctx->active_thread_type & FF_THREAD_FRAME))902 if (HAVE_THREADS && (s->avctx->active_thread_type & FF_THREAD_FRAME))
901 ff_thread_await_progress(&s->next_pic_ptr->tf, FFMAX(0, s->mb_y-1), 0);903 ff_thread_await_progress(&s->next_pic_ptr->tf, FFMAX(0, s->mb_y-1), 0);
902 904
903 next_bt = s->next_pic_ptr->mb_type[s->mb_x + s->mb_y * s->mb_stride];905 next_bt = s->next_pic.mb_type[s->mb_x + s->mb_y * s->mb_stride];
904 if(IS_INTRA(next_bt) || IS_SKIP(next_bt)){906 if(IS_INTRA(next_bt) || IS_SKIP(next_bt)){
905 ZERO8x2(s->cur_pic_ptr->motion_val[0][s->mb_x * 2 + s->mb_y * 2 * s->b8_stride], s->b8_stride);907 ZERO8x2(s->cur_pic.motion_val[0][s->mb_x * 2 + s->mb_y * 2 * s->b8_stride], s->b8_stride);
906 ZERO8x2(s->cur_pic_ptr->motion_val[1][s->mb_x * 2 + s->mb_y * 2 * s->b8_stride], s->b8_stride);908 ZERO8x2(s->cur_pic.motion_val[1][s->mb_x * 2 + s->mb_y * 2 * s->b8_stride], s->b8_stride);
907 }else909 }else
908 for(j = 0; j < 2; j++)910 for(j = 0; j < 2; j++)
909 for(i = 0; i < 2; i++)911 for(i = 0; i < 2; i++)
910 for(k = 0; k < 2; k++)912 for(k = 0; k < 2; k++)
911 for(l = 0; l < 2; l++)913 for(l = 0; l < 2; l++)
912 s->cur_pic_ptr->motion_val[l][mv_pos + i + j*s->b8_stride][k] = calc_add_mv(r, l, s->next_pic_ptr->motion_val[0][mv_pos + i + j*s->b8_stride][k]);914 s->cur_pic.motion_val[l][mv_pos + i + j*s->b8_stride][k] = calc_add_mv(r, l, s->next_pic.motion_val[0][mv_pos + i + j*s->b8_stride][k]);
913 if(!(IS_16X8(next_bt) || IS_8X16(next_bt) || IS_8X8(next_bt))) //we can use whole macroblock MC915 if(!(IS_16X8(next_bt) || IS_8X16(next_bt) || IS_8X8(next_bt))) //we can use whole macroblock MC
914 rv34_mc_2mv(r, block_type);916 rv34_mc_2mv(r, block_type);
915 else917 else
916 rv34_mc_2mv_skip(r);918 rv34_mc_2mv_skip(r);
917 ZERO8x2(s->cur_pic_ptr->motion_val[0][s->mb_x * 2 + s->mb_y * 2 * s->b8_stride], s->b8_stride);919 ZERO8x2(s->cur_pic.motion_val[0][s->mb_x * 2 + s->mb_y * 2 * s->b8_stride], s->b8_stride);
918 break;920 break;
919 case RV34_MB_P_16x16:921 case RV34_MB_P_16x16:
920 case RV34_MB_P_MIX16x16:922 case RV34_MB_P_MIX16x16:
@@ -1182,7 +1184,7 @@ static int rv34_set_deblock_coef(RV34DecContext *r) · 261 unmodified lines
1182 MpegEncContext *s = &r->s;1184 MpegEncContext *s = &r->s;
1183 int hmvmask = 0, vmvmask = 0, i, j;1185 int hmvmask = 0, vmvmask = 0, i, j;
1184 int midx = s->mb_x * 2 + s->mb_y * 2 * s->b8_stride;1186 int midx = s->mb_x * 2 + s->mb_y * 2 * s->b8_stride;
1185 int16_t (*motion_val)[2] = &s->cur_pic_ptr->motion_val[0][midx];1187 int16_t (*motion_val)[2] = &s->cur_pic.motion_val[0][midx];
1186 for(j = 0; j < 16; j += 8){1188 for(j = 0; j < 16; j += 8){
1187 for(i = 0; i < 2; i++){1189 for(i = 0; i < 2; i++){
1188 if(is_mv_diff_gt_3(motion_val + i, 1))1190 if(is_mv_diff_gt_3(motion_val + i, 1))
@@ -1225,26 +1227,26 @@ static int rv34_decode_inter_macroblock(RV34DecContext *r, int8_t *intra_types) · 36 unmodified lines
1225 dist = (s->mb_x - s->resync_mb_x) + (s->mb_y - s->resync_mb_y) * s->mb_width;1227 dist = (s->mb_x - s->resync_mb_x) + (s->mb_y - s->resync_mb_y) * s->mb_width;
1226 if(s->mb_x && dist)1228 if(s->mb_x && dist)
1227 r->avail_cache[5] =1229 r->avail_cache[5] =
1228 r->avail_cache[9] = s->cur_pic_ptr->mb_type[mb_pos - 1];1230 r->avail_cache[9] = s->cur_pic.mb_type[mb_pos - 1];
1229 if(dist >= s->mb_width)1231 if(dist >= s->mb_width)
1230 r->avail_cache[2] =1232 r->avail_cache[2] =
1231 r->avail_cache[3] = s->cur_pic_ptr->mb_type[mb_pos - s->mb_stride];1233 r->avail_cache[3] = s->cur_pic.mb_type[mb_pos - s->mb_stride];
1232 if(((s->mb_x+1) < s->mb_width) && dist >= s->mb_width - 1)1234 if(((s->mb_x+1) < s->mb_width) && dist >= s->mb_width - 1)
1233 r->avail_cache[4] = s->cur_pic_ptr->mb_type[mb_pos - s->mb_stride + 1];1235 r->avail_cache[4] = s->cur_pic.mb_type[mb_pos - s->mb_stride + 1];
1234 if(s->mb_x && dist > s->mb_width)1236 if(s->mb_x && dist > s->mb_width)
1235 r->avail_cache[1] = s->cur_pic_ptr->mb_type[mb_pos - s->mb_stride - 1];1237 r->avail_cache[1] = s->cur_pic.mb_type[mb_pos - s->mb_stride - 1];
1236 1238
1237 s->qscale = r->si.quant;1239 s->qscale = r->si.quant;
1238 cbp = cbp2 = rv34_decode_inter_mb_header(r, intra_types);1240 cbp = cbp2 = rv34_decode_inter_mb_header(r, intra_types);
1239 r->cbp_luma [mb_pos] = cbp;1241 r->cbp_luma [mb_pos] = cbp;
1240 r->cbp_chroma[mb_pos] = cbp >> 16;1242 r->cbp_chroma[mb_pos] = cbp >> 16;
1241 r->deblock_coefs[mb_pos] = rv34_set_deblock_coef(r) | r->cbp_luma[mb_pos];1243 r->deblock_coefs[mb_pos] = rv34_set_deblock_coef(r) | r->cbp_luma[mb_pos];
1242 s->cur_pic_ptr->qscale_table[mb_pos] = s->qscale;1244 s->cur_pic.qscale_table[mb_pos] = s->qscale;
1243 1245
1244 if(cbp == -1)1246 if(cbp == -1)
1245 return -1;1247 return -1;
1246 1248
1247 if (IS_INTRA(s->cur_pic_ptr->mb_type[mb_pos])){1249 if (IS_INTRA(s->cur_pic.mb_type[mb_pos])) {
1248 if(r->is16) rv34_output_i16x16(r, intra_types, cbp);1250 if(r->is16) rv34_output_i16x16(r, intra_types, cbp);
1249 else rv34_output_intra(r, intra_types, cbp);1251 else rv34_output_intra(r, intra_types, cbp);
1250 return 0;1252 return 0;
@@ -1327,21 +1329,21 @@ static int rv34_decode_intra_macroblock(RV34DecContext *r, int8_t *intra_types) · 76 unmodified lines
1327 dist = (s->mb_x - s->resync_mb_x) + (s->mb_y - s->resync_mb_y) * s->mb_width;1329 dist = (s->mb_x - s->resync_mb_x) + (s->mb_y - s->resync_mb_y) * s->mb_width;
1328 if(s->mb_x && dist)1330 if(s->mb_x && dist)
1329 r->avail_cache[5] =1331 r->avail_cache[5] =
1330 r->avail_cache[9] = s->cur_pic_ptr->mb_type[mb_pos - 1];1332 r->avail_cache[9] = s->cur_pic.mb_type[mb_pos - 1];
1331 if(dist >= s->mb_width)1333 if(dist >= s->mb_width)
1332 r->avail_cache[2] =1334 r->avail_cache[2] =
1333 r->avail_cache[3] = s->cur_pic_ptr->mb_type[mb_pos - s->mb_stride];1335 r->avail_cache[3] = s->cur_pic.mb_type[mb_pos - s->mb_stride];
1334 if(((s->mb_x+1) < s->mb_width) && dist >= s->mb_width - 1)1336 if(((s->mb_x+1) < s->mb_width) && dist >= s->mb_width - 1)
1335 r->avail_cache[4] = s->cur_pic_ptr->mb_type[mb_pos - s->mb_stride + 1];1337 r->avail_cache[4] = s->cur_pic.mb_type[mb_pos - s->mb_stride + 1];
1336 if(s->mb_x && dist > s->mb_width)1338 if(s->mb_x && dist > s->mb_width)
1337 r->avail_cache[1] = s->cur_pic_ptr->mb_type[mb_pos - s->mb_stride - 1];1339 r->avail_cache[1] = s->cur_pic.mb_type[mb_pos - s->mb_stride - 1];
1338 1340
1339 s->qscale = r->si.quant;1341 s->qscale = r->si.quant;
1340 cbp = rv34_decode_intra_mb_header(r, intra_types);1342 cbp = rv34_decode_intra_mb_header(r, intra_types);
1341 r->cbp_luma [mb_pos] = cbp;1343 r->cbp_luma [mb_pos] = cbp;
1342 r->cbp_chroma[mb_pos] = cbp >> 16;1344 r->cbp_chroma[mb_pos] = cbp >> 16;
1343 r->deblock_coefs[mb_pos] = 0xFFFF;1345 r->deblock_coefs[mb_pos] = 0xFFFF;
1344 s->cur_pic_ptr->qscale_table[mb_pos] = s->qscale;1346 s->cur_pic.qscale_table[mb_pos] = s->qscale;
1345 1347
1346 if(cbp == -1)1348 if(cbp == -1)
1347 return -1;1349 return -1;
libavcodec/rv40.c+5−5
@@ -371,7 +371,7 @@ static void rv40_loop_filter(RV34DecContext *r, int row) · 370 unmodified lines
371 371
372 mb_pos = row * s->mb_stride;372 mb_pos = row * s->mb_stride;
373 for(mb_x = 0; mb_x < s->mb_width; mb_x++, mb_pos++){373 for(mb_x = 0; mb_x < s->mb_width; mb_x++, mb_pos++){
374 int mbtype = s->cur_pic_ptr->mb_type[mb_pos];374 int mbtype = s->cur_pic.mb_type[mb_pos];
375 if(IS_INTRA(mbtype) || IS_SEPARATE_DC(mbtype))375 if(IS_INTRA(mbtype) || IS_SEPARATE_DC(mbtype))
376 r->cbp_luma [mb_pos] = r->deblock_coefs[mb_pos] = 0xFFFF;376 r->cbp_luma [mb_pos] = r->deblock_coefs[mb_pos] = 0xFFFF;
377 if(IS_INTRA(mbtype))377 if(IS_INTRA(mbtype))
@@ -386,7 +386,7 @@ static void rv40_loop_filter(RV34DecContext *r, int row) · 8 unmodified lines
386 unsigned y_to_deblock;386 unsigned y_to_deblock;
387 int c_to_deblock[2];387 int c_to_deblock[2];
388 388
389 q = s->cur_pic_ptr->qscale_table[mb_pos];389 q = s->cur_pic.qscale_table[mb_pos];
390 alpha = rv40_alpha_tab[q];390 alpha = rv40_alpha_tab[q];
391 beta = rv40_beta_tab [q];391 beta = rv40_beta_tab [q];
392 betaY = betaC = beta * 3;392 betaY = betaC = beta * 3;
@@ -401,7 +401,7 @@ static void rv40_loop_filter(RV34DecContext *r, int row) · 8 unmodified lines
401 if(avail[i]){401 if(avail[i]){
402 int pos = mb_pos + neighbour_offs_x[i] + neighbour_offs_y[i]*s->mb_stride;402 int pos = mb_pos + neighbour_offs_x[i] + neighbour_offs_y[i]*s->mb_stride;
403 mvmasks[i] = r->deblock_coefs[pos];403 mvmasks[i] = r->deblock_coefs[pos];
404 mbtype [i] = s->cur_pic_ptr->mb_type[pos];404 mbtype [i] = s->cur_pic.mb_type[pos];
405 cbp [i] = r->cbp_luma[pos];405 cbp [i] = r->cbp_luma[pos];
406 uvcbp[i][0] = r->cbp_chroma[pos] & 0xF;406 uvcbp[i][0] = r->cbp_chroma[pos] & 0xF;
407 uvcbp[i][1] = r->cbp_chroma[pos] >> 4;407 uvcbp[i][1] = r->cbp_chroma[pos] >> 4;
@@ -460,7 +460,7 @@ static void rv40_loop_filter(RV34DecContext *r, int row) · 52 unmodified lines
460 }460 }
461 461
462 for(j = 0; j < 16; j += 4){462 for(j = 0; j < 16; j += 4){
463 Y = s->cur_pic_ptr->f->data[0] + mb_x*16 + (row*16 + j) * s->linesize;463 Y = s->cur_pic.data[0] + mb_x*16 + (row*16 + j) * s->linesize;
464 for(i = 0; i < 4; i++, Y += 4){464 for(i = 0; i < 4; i++, Y += 4){
465 int ij = i + j;465 int ij = i + j;
466 int clip_cur = y_to_deblock & (MASK_CUR << ij) ? clip[POS_CUR] : 0;466 int clip_cur = y_to_deblock & (MASK_CUR << ij) ? clip[POS_CUR] : 0;
@@ -505,7 +505,7 @@ static void rv40_loop_filter(RV34DecContext *r, int row) · 38 unmodified lines
505 }505 }
506 for(k = 0; k < 2; k++){506 for(k = 0; k < 2; k++){
507 for(j = 0; j < 2; j++){507 for(j = 0; j < 2; j++){
508 C = s->cur_pic_ptr->f->data[k + 1] + mb_x*8 + (row*8 + j*4) * s->uvlinesize;508 C = s->cur_pic.data[k + 1] + mb_x*8 + (row*8 + j*4) * s->uvlinesize;
509 for(i = 0; i < 2; i++, C += 4){509 for(i = 0; i < 2; i++, C += 4){
510 int ij = i + j*2;510 int ij = i + j*2;
511 int clip_cur = c_to_deblock[k] & (MASK_CUR << ij) ? clip[POS_CUR] : 0;511 int clip_cur = c_to_deblock[k] & (MASK_CUR << ij) ? clip[POS_CUR] : 0;
libavcodec/wmv2dec.c+3−4
@@ -103,7 +103,7 @@ static int parse_mb_skip(WMV2DecContext *w) · 102 unmodified lines
103 int mb_x, mb_y;103 int mb_x, mb_y;
104 int coded_mb_count = 0;104 int coded_mb_count = 0;
105 MpegEncContext *const s = &w->s;105 MpegEncContext *const s = &w->s;
106 uint32_t *const mb_type = s->cur_pic_ptr->mb_type;106 uint32_t *const mb_type = s->cur_pic.mb_type;
107 107
108 w->skip_type = get_bits(&s->gb, 2);108 w->skip_type = get_bits(&s->gb, 2);
109 switch (w->skip_type) {109 switch (w->skip_type) {
@@ -238,9 +238,8 @@ int ff_wmv2_decode_secondary_picture_header(MpegEncContext *s) · 128 unmodified lines
238 238
239 if (s->pict_type == AV_PICTURE_TYPE_I) {239 if (s->pict_type == AV_PICTURE_TYPE_I) {
240 /* Is filling with zeroes really the right thing to do? */240 /* Is filling with zeroes really the right thing to do? */
241 memset(s->cur_pic_ptr->mb_type, 0,241 memset(s->cur_pic.mb_type, 0,
242 sizeof(*s->cur_pic_ptr->mb_type) *242 sizeof(*s->cur_pic.mb_type) * s->mb_height * s->mb_stride);
243 s->mb_height * s->mb_stride);
244 if (w->j_type_bit)243 if (w->j_type_bit)
245 w->j_type = get_bits1(&s->gb);244 w->j_type = get_bits1(&s->gb);
246 else245 else

Keyboard shortcuts

General

Show keyboard shortcuts
?
Focus the current search
/

Issues and pull requests

Open filters
f

Issues, pull requests and Inbox

Select next item
j↓
Select previous item
k↑
Open selected item
Enter
Dismiss filters or clear selection
Esc

Repository code

Go to file
t