This avoids an indirection and is in preparation for removing the AVFrame from MpegEncContext.(cur|last|next)_pic altogether.
Unified · Split
| @@ -703,11 +703,11 @@ static inline int h263_mv4_search(MpegEncContext *s, int mx, int my, int shift) · 702 unmodified lines | ||
| 703 | 703 | offset= (s->mb_x*8 + (mx>>1)) + (s->mb_y*8 + (my>>1))*s->uvlinesize; |
| 704 | 704 | |
| 705 | 705 | if(s->no_rounding){ |
| 706 | − s->hdsp.put_no_rnd_pixels_tab[1][dxy](c->scratchpad , s->last_pic.f->data[1] + offset, s->uvlinesize, 8); | |
| 707 | − s->hdsp.put_no_rnd_pixels_tab[1][dxy](c->scratchpad + 8, s->last_pic.f->data[2] + offset, s->uvlinesize, 8); | |
| 706 | + s->hdsp.put_no_rnd_pixels_tab[1][dxy](c->scratchpad , s->last_pic.data[1] + offset, s->uvlinesize, 8); | |
| 707 | + s->hdsp.put_no_rnd_pixels_tab[1][dxy](c->scratchpad + 8, s->last_pic.data[2] + offset, s->uvlinesize, 8); | |
| 708 | 708 | }else{ |
| 709 | − s->hdsp.put_pixels_tab [1][dxy](c->scratchpad , s->last_pic.f->data[1] + offset, s->uvlinesize, 8); | |
| 710 | − s->hdsp.put_pixels_tab [1][dxy](c->scratchpad + 8, s->last_pic.f->data[2] + offset, s->uvlinesize, 8); | |
| 709 | + s->hdsp.put_pixels_tab [1][dxy](c->scratchpad , s->last_pic.data[1] + offset, s->uvlinesize, 8); | |
| 710 | + s->hdsp.put_pixels_tab [1][dxy](c->scratchpad + 8, s->last_pic.data[2] + offset, s->uvlinesize, 8); | |
| 711 | 711 | } |
| 712 | 712 | |
| 713 | 713 | dmin_sum += s->mecc.mb_cmp[1](s, s->new_pic->data[1] + s->mb_x * 8 + s->mb_y * 8 * s->uvlinesize, c->scratchpad, s->uvlinesize, 8); |
| @@ -899,7 +899,7 @@ void ff_estimate_p_frame_motion(MpegEncContext * s, · 185 unmodified lines | ||
| 899 | 899 | const int shift= 1+s->quarter_sample; |
| 900 | 900 | int mb_type=0; |
| 901 | 901 | |
| 902 | − init_ref(c, s->new_pic->data, s->last_pic.f->data, NULL, 16*mb_x, 16*mb_y, 0); | |
| 902 | + init_ref(c, s->new_pic->data, s->last_pic.data, NULL, 16*mb_x, 16*mb_y, 0); | |
| 903 | 903 | |
| 904 | 904 | av_assert0(s->quarter_sample==0 || s->quarter_sample==1); |
| 905 | 905 | av_assert0(s->linesize == c->stride); |
| @@ -1070,7 +1070,7 @@ int ff_pre_estimate_p_frame_motion(MpegEncContext * s, · 164 unmodified lines | ||
| 1070 | 1070 | int P[10][2]; |
| 1071 | 1071 | const int shift= 1+s->quarter_sample; |
| 1072 | 1072 | const int xy= mb_x + mb_y*s->mb_stride; |
| 1073 | − init_ref(c, s->new_pic->data, s->last_pic.f->data, NULL, 16*mb_x, 16*mb_y, 0); | |
| 1073 | + init_ref(c, s->new_pic->data, s->last_pic.data, NULL, 16*mb_x, 16*mb_y, 0); | |
| 1074 | 1074 | |
| 1075 | 1075 | av_assert0(s->quarter_sample==0 || s->quarter_sample==1); |
| 1076 | 1076 | |
| @@ -1495,8 +1495,8 @@ void ff_estimate_b_frame_motion(MpegEncContext * s, · 418 unmodified lines | ||
| 1495 | 1495 | int fmin, bmin, dmin, fbmin, bimin, fimin; |
| 1496 | 1496 | int type=0; |
| 1497 | 1497 | const int xy = mb_y*s->mb_stride + mb_x; |
| 1498 | − init_ref(c, s->new_pic->data, s->last_pic.f->data, | |
| 1499 | − s->next_pic.f->data, 16 * mb_x, 16 * mb_y, 2); | |
| 1498 | + init_ref(c, s->new_pic->data, s->last_pic.data, | |
| 1499 | + s->next_pic.data, 16 * mb_x, 16 * mb_y, 2); | |
| 1500 | 1500 | |
| 1501 | 1501 | get_limits(s, 16*mb_x, 16*mb_y); |
| 1502 | 1502 | |
| @@ -1297,12 +1297,12 @@ static int mpeg_field_start(MpegEncContext *s, const uint8_t *buf, int buf_size) · 1296 unmodified lines | ||
| 1297 | 1297 | |
| 1298 | 1298 | for (int i = 0; i < 3; i++) { |
| 1299 | 1299 | if (s->picture_structure == PICT_BOTTOM_FIELD) { |
| 1300 | − s->cur_pic.f->data[i] = FF_PTR_ADD(s->cur_pic.f->data[i], | |
| 1301 | − s->cur_pic.f->linesize[i]); | |
| 1300 | + s->cur_pic.data[i] = FF_PTR_ADD(s->cur_pic.data[i], | |
| 1301 | + s->cur_pic.linesize[i]); | |
| 1302 | 1302 | } |
| 1303 | − s->cur_pic.f->linesize[i] *= 2; | |
| 1304 | − s->last_pic.f->linesize[i] *= 2; | |
| 1305 | − s->next_pic.f->linesize[i] *= 2; | |
| 1303 | + s->cur_pic.linesize[i] *= 2; | |
| 1304 | + s->last_pic.linesize[i] *= 2; | |
| 1305 | + s->next_pic.linesize[i] *= 2; | |
| 1306 | 1306 | } |
| 1307 | 1307 | } |
| 1308 | 1308 | |
| @@ -1377,9 +1377,9 @@ static int mpeg_field_start(MpegEncContext *s, const uint8_t *buf, int buf_size) · 68 unmodified lines | ||
| 1377 | 1377 | return ret; |
| 1378 | 1378 | |
| 1379 | 1379 | for (int i = 0; i < 3; i++) { |
| 1380 | − s->cur_pic.f->data[i] = s->cur_pic_ptr->f->data[i]; | |
| 1380 | + s->cur_pic.data[i] = s->cur_pic_ptr->f->data[i]; | |
| 1381 | 1381 | if (s->picture_structure == PICT_BOTTOM_FIELD) |
| 1382 | − s->cur_pic.f->data[i] += | |
| 1382 | + s->cur_pic.data[i] += | |
| 1383 | 1383 | s->cur_pic_ptr->f->linesize[i]; |
| 1384 | 1384 | } |
| 1385 | 1385 | } |
| @@ -84,13 +84,13 @@ static void mpeg_er_decode_mb(void *opaque, int ref, int mv_dir, int mv_type, · 83 unmodified lines | ||
| 84 | 84 | if (!s->chroma_y_shift) |
| 85 | 85 | s->bdsp.clear_blocks(s->block[6]); |
| 86 | 86 | |
| 87 | − s->dest[0] = s->cur_pic.f->data[0] + | |
| 87 | + s->dest[0] = s->cur_pic.data[0] + | |
| 88 | 88 | s->mb_y * 16 * s->linesize + |
| 89 | 89 | s->mb_x * 16; |
| 90 | − s->dest[1] = s->cur_pic.f->data[1] + | |
| 90 | + s->dest[1] = s->cur_pic.data[1] + | |
| 91 | 91 | s->mb_y * (16 >> s->chroma_y_shift) * s->uvlinesize + |
| 92 | 92 | s->mb_x * (16 >> s->chroma_x_shift); |
| 93 | − s->dest[2] = s->cur_pic.f->data[2] + | |
| 93 | + s->dest[2] = s->cur_pic.data[2] + | |
| 94 | 94 | s->mb_y * (16 >> s->chroma_y_shift) * s->uvlinesize + |
| 95 | 95 | s->mb_x * (16 >> s->chroma_x_shift); |
| 96 | 96 | |
| @@ -174,6 +174,11 @@ int ff_alloc_picture(AVCodecContext *avctx, Picture *pic, MotionEstContext *me, · 173 unmodified lines | ||
| 174 | 174 | *linesize = pic->f->linesize[0]; |
| 175 | 175 | *uvlinesize = pic->f->linesize[1]; |
| 176 | 176 | |
| 177 | + for (int i = 0; i < MPV_MAX_PLANES; i++) { | |
| 178 | + pic->data[i] = pic->f->data[i]; | |
| 179 | + pic->linesize[i] = pic->f->linesize[i]; | |
| 180 | + } | |
| 181 | + | |
| 177 | 182 | ret = alloc_picture_tables(pools, pic, mb_height); |
| 178 | 183 | if (ret < 0) |
| 179 | 184 | goto fail; |
| @@ -206,7 +211,11 @@ void ff_mpeg_unref_picture(Picture *pic) · 26 unmodified lines | ||
| 206 | 211 | |
| 207 | 212 | free_picture_tables(pic); |
| 208 | 213 | |
| 214 | + memset(pic->data, 0, sizeof(pic->data)); | |
| 215 | + memset(pic->linesize, 0, sizeof(pic->linesize)); | |
| 216 | + | |
| 209 | 217 | pic->dummy = 0; |
| 218 | + | |
| 210 | 219 | pic->field_picture = 0; |
| 211 | 220 | pic->b_frame_score = 0; |
| 212 | 221 | pic->reference = 0; |
| @@ -248,6 +257,11 @@ int ff_mpeg_ref_picture(Picture *dst, Picture *src) · 35 unmodified lines | ||
| 248 | 257 | if (ret < 0) |
| 249 | 258 | goto fail; |
| 250 | 259 | |
| 260 | + for (int i = 0; i < MPV_MAX_PLANES; i++) { | |
| 261 | + dst->data[i] = src->data[i]; | |
| 262 | + dst->linesize[i] = src->linesize[i]; | |
| 263 | + } | |
| 264 | + | |
| 251 | 265 | update_picture_tables(dst, src); |
| 252 | 266 | |
| 253 | 267 | ff_refstruct_replace(&dst->hwaccel_picture_private, |
| @@ -21,6 +21,7 @@ · 20 unmodified lines | ||
| 21 | 21 | #ifndef AVCODEC_MPEGPICTURE_H |
| 22 | 22 | #define AVCODEC_MPEGPICTURE_H |
| 23 | 23 | |
| 24 | +#include <stddef.h> | |
| 24 | 25 | #include <stdint.h> |
| 25 | 26 | |
| 26 | 27 | #include "avcodec.h" |
| @@ -57,6 +58,9 @@ typedef struct Picture { · 30 unmodified lines | ||
| 57 | 58 | struct AVFrame *f; |
| 58 | 59 | ThreadFrame tf; |
| 59 | 60 | |
| 61 | + uint8_t *data[MPV_MAX_PLANES]; | |
| 62 | + ptrdiff_t linesize[MPV_MAX_PLANES]; | |
| 63 | + | |
| 60 | 64 | int8_t *qscale_table_base; |
| 61 | 65 | int8_t *qscale_table; |
| 62 | 66 | |
| @@ -881,8 +881,8 @@ void ff_clean_intra_table_entries(MpegEncContext *s) · 880 unmodified lines | ||
| 881 | 881 | } |
| 882 | 882 | |
| 883 | 883 | void ff_init_block_index(MpegEncContext *s){ //FIXME maybe rename |
| 884 | − const int linesize = s->cur_pic.f->linesize[0]; //not s->linesize as this would be wrong for field pics | |
| 885 | − const int uvlinesize = s->cur_pic.f->linesize[1]; | |
| 884 | + const int linesize = s->cur_pic.linesize[0]; //not s->linesize as this would be wrong for field pics | |
| 885 | + const int uvlinesize = s->cur_pic.linesize[1]; | |
| 886 | 886 | const int width_of_mb = (4 + (s->avctx->bits_per_raw_sample > 8)) - s->avctx->lowres; |
| 887 | 887 | const int height_of_mb = 4 - s->avctx->lowres; |
| 888 | 888 | |
| @@ -894,9 +894,9 @@ void ff_init_block_index(MpegEncContext *s){ //FIXME maybe rename · 5 unmodified lines | ||
| 894 | 894 | s->block_index[5]= s->mb_stride*(s->mb_y + s->mb_height + 2) + s->b8_stride*s->mb_height*2 + s->mb_x - 1; |
| 895 | 895 | //block_index is not used by mpeg2, so it is not affected by chroma_format |
| 896 | 896 | |
| 897 | − s->dest[0] = s->cur_pic.f->data[0] + (int)((s->mb_x - 1U) << width_of_mb); | |
| 898 | − s->dest[1] = s->cur_pic.f->data[1] + (int)((s->mb_x - 1U) << (width_of_mb - s->chroma_x_shift)); | |
| 899 | − s->dest[2] = s->cur_pic.f->data[2] + (int)((s->mb_x - 1U) << (width_of_mb - s->chroma_x_shift)); | |
| 897 | + s->dest[0] = s->cur_pic.data[0] + (int)((s->mb_x - 1U) << width_of_mb); | |
| 898 | + s->dest[1] = s->cur_pic.data[1] + (int)((s->mb_x - 1U) << (width_of_mb - s->chroma_x_shift)); | |
| 899 | + s->dest[2] = s->cur_pic.data[2] + (int)((s->mb_x - 1U) << (width_of_mb - s->chroma_x_shift)); | |
| 900 | 900 | |
| 901 | 901 | if (s->picture_structure == PICT_FRAME) { |
| 902 | 902 | s->dest[0] += s->mb_y * linesize << height_of_mb; |
| @@ -613,8 +613,8 @@ static av_always_inline void mpeg_motion_lowres(MpegEncContext *s, · 612 unmodified lines | ||
| 613 | 613 | const int h_edge_pos = s->h_edge_pos >> lowres; |
| 614 | 614 | const int v_edge_pos = s->v_edge_pos >> lowres; |
| 615 | 615 | int hc = s->chroma_y_shift ? (h+1-bottom_field)>>1 : h; |
| 616 | − linesize = s->cur_pic.f->linesize[0] << field_based; | |
| 617 | − uvlinesize = s->cur_pic.f->linesize[1] << field_based; | |
| 616 | + linesize = s->cur_pic.linesize[0] << field_based; | |
| 617 | + uvlinesize = s->cur_pic.linesize[1] << field_based; | |
| 618 | 618 | |
| 619 | 619 | // FIXME obviously not perfect but qpel will not work in lowres anyway |
| 620 | 620 | if (s->quarter_sample) { |
| @@ -1655,20 +1655,20 @@ static void frame_end(MpegEncContext *s) · 1654 unmodified lines | ||
| 1655 | 1655 | !s->intra_only) { |
| 1656 | 1656 | int hshift = s->chroma_x_shift; |
| 1657 | 1657 | int vshift = s->chroma_y_shift; |
| 1658 | − s->mpvencdsp.draw_edges(s->cur_pic.f->data[0], | |
| 1659 | − s->cur_pic.f->linesize[0], | |
| 1658 | + s->mpvencdsp.draw_edges(s->cur_pic.data[0], | |
| 1659 | + s->cur_pic.linesize[0], | |
| 1660 | 1660 | s->h_edge_pos, s->v_edge_pos, |
| 1661 | 1661 | EDGE_WIDTH, EDGE_WIDTH, |
| 1662 | 1662 | EDGE_TOP | EDGE_BOTTOM); |
| 1663 | − s->mpvencdsp.draw_edges(s->cur_pic.f->data[1], | |
| 1664 | − s->cur_pic.f->linesize[1], | |
| 1663 | + s->mpvencdsp.draw_edges(s->cur_pic.data[1], | |
| 1664 | + s->cur_pic.linesize[1], | |
| 1665 | 1665 | s->h_edge_pos >> hshift, |
| 1666 | 1666 | s->v_edge_pos >> vshift, |
| 1667 | 1667 | EDGE_WIDTH >> hshift, |
| 1668 | 1668 | EDGE_WIDTH >> vshift, |
| 1669 | 1669 | EDGE_TOP | EDGE_BOTTOM); |
| 1670 | − s->mpvencdsp.draw_edges(s->cur_pic.f->data[2], | |
| 1671 | − s->cur_pic.f->linesize[2], | |
| 1670 | + s->mpvencdsp.draw_edges(s->cur_pic.data[2], | |
| 1671 | + s->cur_pic.linesize[2], | |
| 1672 | 1672 | s->h_edge_pos >> hshift, |
| 1673 | 1673 | s->v_edge_pos >> vshift, |
| 1674 | 1674 | EDGE_WIDTH >> hshift, |
| @@ -2268,14 +2268,14 @@ static av_always_inline void encode_mb_internal(MpegEncContext *s, · 593 unmodified lines | ||
| 2268 | 2268 | |
| 2269 | 2269 | if (s->mv_dir & MV_DIR_FORWARD) { |
| 2270 | 2270 | ff_mpv_motion(s, dest_y, dest_cb, dest_cr, 0, |
| 2271 | − s->last_pic.f->data, | |
| 2271 | + s->last_pic.data, | |
| 2272 | 2272 | op_pix, op_qpix); |
| 2273 | 2273 | op_pix = s->hdsp.avg_pixels_tab; |
| 2274 | 2274 | op_qpix = s->qdsp.avg_qpel_pixels_tab; |
| 2275 | 2275 | } |
| 2276 | 2276 | if (s->mv_dir & MV_DIR_BACKWARD) { |
| 2277 | 2277 | ff_mpv_motion(s, dest_y, dest_cb, dest_cr, 1, |
| 2278 | − s->next_pic.f->data, | |
| 2278 | + s->next_pic.data, | |
| 2279 | 2279 | op_pix, op_qpix); |
| 2280 | 2280 | } |
| 2281 | 2281 | |
| @@ -93,8 +93,8 @@ void mpeg_motion_internal(MpegEncContext *s, · 92 unmodified lines | ||
| 93 | 93 | ptrdiff_t uvlinesize, linesize; |
| 94 | 94 | |
| 95 | 95 | v_edge_pos = s->v_edge_pos >> field_based; |
| 96 | − linesize = s->cur_pic.f->linesize[0] << field_based; | |
| 97 | − uvlinesize = s->cur_pic.f->linesize[1] << field_based; | |
| 96 | + linesize = s->cur_pic.linesize[0] << field_based; | |
| 97 | + uvlinesize = s->cur_pic.linesize[1] << field_based; | |
| 98 | 98 | block_y_half = (field_based | is_16x8); |
| 99 | 99 | |
| 100 | 100 | dxy = ((motion_y & 1) << 1) | (motion_x & 1); |
| @@ -82,8 +82,8 @@ void mpv_reconstruct_mb_internal(MpegEncContext *s, int16_t block[12][64], · 81 unmodified lines | ||
| 82 | 82 | { |
| 83 | 83 | uint8_t *dest_y, *dest_cb, *dest_cr; |
| 84 | 84 | int dct_linesize, dct_offset; |
| 85 | − const int linesize = s->cur_pic.f->linesize[0]; //not s->linesize as this would be wrong for field pics | |
| 86 | − const int uvlinesize = s->cur_pic.f->linesize[1]; | |
| 85 | + const int linesize = s->cur_pic.linesize[0]; //not s->linesize as this would be wrong for field pics | |
| 86 | + const int uvlinesize = s->cur_pic.linesize[1]; | |
| 87 | 87 | const int readable = IS_ENCODER || lowres_flag || s->pict_type != AV_PICTURE_TYPE_B; |
| 88 | 88 | const int block_size = lowres_flag ? 8 >> s->avctx->lowres : 8; |
| 89 | 89 | |
| @@ -137,11 +137,11 @@ void mpv_reconstruct_mb_internal(MpegEncContext *s, int16_t block[12][64], · 47 unmodified lines | ||
| 137 | 137 | const h264_chroma_mc_func *op_pix = s->h264chroma.put_h264_chroma_pixels_tab; |
| 138 | 138 | |
| 139 | 139 | if (s->mv_dir & MV_DIR_FORWARD) { |
| 140 | − MPV_motion_lowres(s, dest_y, dest_cb, dest_cr, 0, s->last_pic.f->data, op_pix); | |
| 140 | + MPV_motion_lowres(s, dest_y, dest_cb, dest_cr, 0, s->last_pic.data, op_pix); | |
| 141 | 141 | op_pix = s->h264chroma.avg_h264_chroma_pixels_tab; |
| 142 | 142 | } |
| 143 | 143 | if (s->mv_dir & MV_DIR_BACKWARD) { |
| 144 | − MPV_motion_lowres(s, dest_y, dest_cb, dest_cr, 1, s->next_pic.f->data, op_pix); | |
| 144 | + MPV_motion_lowres(s, dest_y, dest_cb, dest_cr, 1, s->next_pic.data, op_pix); | |
| 145 | 145 | } |
| 146 | 146 | } else { |
| 147 | 147 | op_pixels_func (*op_pix)[4]; |
| @@ -155,12 +155,12 @@ void mpv_reconstruct_mb_internal(MpegEncContext *s, int16_t block[12][64], · 7 unmodified lines | ||
| 155 | 155 | op_qpix = s->qdsp.put_no_rnd_qpel_pixels_tab; |
| 156 | 156 | } |
| 157 | 157 | if (s->mv_dir & MV_DIR_FORWARD) { |
| 158 | − ff_mpv_motion(s, dest_y, dest_cb, dest_cr, 0, s->last_pic.f->data, op_pix, op_qpix); | |
| 158 | + ff_mpv_motion(s, dest_y, dest_cb, dest_cr, 0, s->last_pic.data, op_pix, op_qpix); | |
| 159 | 159 | op_pix = s->hdsp.avg_pixels_tab; |
| 160 | 160 | op_qpix = s->qdsp.avg_qpel_pixels_tab; |
| 161 | 161 | } |
| 162 | 162 | if (s->mv_dir & MV_DIR_BACKWARD) { |
| 163 | − ff_mpv_motion(s, dest_y, dest_cb, dest_cr, 1, s->next_pic.f->data, op_pix, op_qpix); | |
| 163 | + ff_mpv_motion(s, dest_y, dest_cb, dest_cr, 1, s->next_pic.data, op_pix, op_qpix); | |
| 164 | 164 | } |
| 165 | 165 | } |
| 166 | 166 | |
| @@ -282,10 +282,10 @@ int ff_msmpeg4_pred_dc(MpegEncContext *s, int n, · 281 unmodified lines | ||
| 282 | 282 | int bs = 8 >> s->avctx->lowres; |
| 283 | 283 | if(n<4){ |
| 284 | 284 | wrap= s->linesize; |
| 285 | − dest = s->cur_pic.f->data[0] + (((n >> 1) + 2*s->mb_y) * bs* wrap ) + ((n & 1) + 2*s->mb_x) * bs; | |
| 285 | + dest = s->cur_pic.data[0] + (((n >> 1) + 2*s->mb_y) * bs* wrap ) + ((n & 1) + 2*s->mb_x) * bs; | |
| 286 | 286 | }else{ |
| 287 | 287 | wrap= s->uvlinesize; |
| 288 | − dest = s->cur_pic.f->data[n - 3] + (s->mb_y * bs * wrap) + s->mb_x * bs; | |
| 288 | + dest = s->cur_pic.data[n - 3] + (s->mb_y * bs * wrap) + s->mb_x * bs; | |
| 289 | 289 | } |
| 290 | 290 | if(s->mb_x==0) a= (1024 + (scale>>1))/scale; |
| 291 | 291 | else a= get_dc(dest-bs, wrap, scale*8>>(2*s->avctx->lowres), bs); |
| @@ -382,7 +382,7 @@ static int decode_wmv9(AVCodecContext *avctx, const uint8_t *buf, int buf_size, · 381 unmodified lines | ||
| 382 | 382 | MSS12Context *c = &ctx->c; |
| 383 | 383 | VC1Context *v = avctx->priv_data; |
| 384 | 384 | MpegEncContext *s = &v->s; |
| 385 | − AVFrame *f; | |
| 385 | + Picture *f; | |
| 386 | 386 | int ret; |
| 387 | 387 | |
| 388 | 388 | ff_mpeg_flush(avctx); |
| @@ -431,7 +431,7 @@ static int decode_wmv9(AVCodecContext *avctx, const uint8_t *buf, int buf_size, · 42 unmodified lines | ||
| 431 | 431 | |
| 432 | 432 | ff_mpv_frame_end(s); |
| 433 | 433 | |
| 434 | − f = s->cur_pic.f; | |
| 434 | + f = &s->cur_pic; | |
| 435 | 435 | |
| 436 | 436 | if (v->respic == 3) { |
| 437 | 437 | ctx->dsp.upsample_plane(f->data[0], f->linesize[0], w, h); |
| @@ -328,11 +328,11 @@ static int svq1_encode_plane(SVQ1EncContext *s, int plane, · 327 unmodified lines | ||
| 328 | 328 | s->m.avctx = s->avctx; |
| 329 | 329 | s->m.cur_pic_ptr = &s->m.cur_pic; |
| 330 | 330 | s->m.last_pic_ptr = &s->m.last_pic; |
| 331 | − s->m.last_pic.f->data[0] = ref_plane; | |
| 331 | + s->m.last_pic.data[0] = ref_plane; | |
| 332 | 332 | s->m.linesize = |
| 333 | − s->m.last_pic.f->linesize[0] = | |
| 333 | + s->m.last_pic.linesize[0] = | |
| 334 | 334 | s->m.new_pic->linesize[0] = |
| 335 | − s->m.cur_pic.f->linesize[0] = stride; | |
| 335 | + s->m.cur_pic.linesize[0] = stride; | |
| 336 | 336 | s->m.width = width; |
| 337 | 337 | s->m.height = height; |
| 338 | 338 | s->m.mb_width = block_width; |
| @@ -2943,7 +2943,7 @@ static void vc1_decode_skip_blocks(VC1Context *v) · 2942 unmodified lines | ||
| 2943 | 2943 | { |
| 2944 | 2944 | MpegEncContext *s = &v->s; |
| 2945 | 2945 | |
| 2946 | − if (!v->s.last_pic.f->data[0]) | |
| 2946 | + if (!v->s.last_pic.data[0]) | |
| 2947 | 2947 | return; |
| 2948 | 2948 | |
| 2949 | 2949 | ff_er_add_slice(&s->er, 0, s->start_mb_y, s->mb_width - 1, s->end_mb_y - 1, ER_MB_END); |
| @@ -2952,9 +2952,9 @@ static void vc1_decode_skip_blocks(VC1Context *v) · 2 unmodified lines | ||
| 2952 | 2952 | s->mb_x = 0; |
| 2953 | 2953 | init_block_index(v); |
| 2954 | 2954 | update_block_index(s); |
| 2955 | − memcpy(s->dest[0], s->last_pic.f->data[0] + s->mb_y * 16 * s->linesize, s->linesize * 16); | |
| 2956 | − memcpy(s->dest[1], s->last_pic.f->data[1] + s->mb_y * 8 * s->uvlinesize, s->uvlinesize * 8); | |
| 2957 | − memcpy(s->dest[2], s->last_pic.f->data[2] + s->mb_y * 8 * s->uvlinesize, s->uvlinesize * 8); | |
| 2955 | + memcpy(s->dest[0], s->last_pic.data[0] + s->mb_y * 16 * s->linesize, s->linesize * 16); | |
| 2956 | + memcpy(s->dest[1], s->last_pic.data[1] + s->mb_y * 8 * s->uvlinesize, s->uvlinesize * 8); | |
| 2957 | + memcpy(s->dest[2], s->last_pic.data[2] + s->mb_y * 8 * s->uvlinesize, s->uvlinesize * 8); | |
| 2958 | 2958 | s->first_slice_line = 0; |
| 2959 | 2959 | } |
| 2960 | 2960 | } |
| @@ -184,7 +184,7 @@ void ff_vc1_mc_1mv(VC1Context *v, int dir) · 183 unmodified lines | ||
| 184 | 184 | |
| 185 | 185 | if ((!v->field_mode || |
| 186 | 186 | (v->ref_field_type[dir] == 1 && v->cur_field_type == 1)) && |
| 187 | − !v->s.last_pic.f->data[0]) | |
| 187 | + !v->s.last_pic.data[0]) | |
| 188 | 188 | return; |
| 189 | 189 | |
| 190 | 190 | linesize = s->cur_pic_ptr->f->linesize[0]; |
| @@ -219,26 +219,26 @@ void ff_vc1_mc_1mv(VC1Context *v, int dir) · 28 unmodified lines | ||
| 219 | 219 | } |
| 220 | 220 | if (!dir) { |
| 221 | 221 | if (v->field_mode && (v->cur_field_type != v->ref_field_type[dir]) && v->second_field) { |
| 222 | − srcY = s->cur_pic.f->data[0]; | |
| 223 | − srcU = s->cur_pic.f->data[1]; | |
| 224 | − srcV = s->cur_pic.f->data[2]; | |
| 222 | + srcY = s->cur_pic.data[0]; | |
| 223 | + srcU = s->cur_pic.data[1]; | |
| 224 | + srcV = s->cur_pic.data[2]; | |
| 225 | 225 | luty = v->curr_luty; |
| 226 | 226 | lutuv = v->curr_lutuv; |
| 227 | 227 | use_ic = *v->curr_use_ic; |
| 228 | 228 | interlace = 1; |
| 229 | 229 | } else { |
| 230 | − srcY = s->last_pic.f->data[0]; | |
| 231 | − srcU = s->last_pic.f->data[1]; | |
| 232 | − srcV = s->last_pic.f->data[2]; | |
| 230 | + srcY = s->last_pic.data[0]; | |
| 231 | + srcU = s->last_pic.data[1]; | |
| 232 | + srcV = s->last_pic.data[2]; | |
| 233 | 233 | luty = v->last_luty; |
| 234 | 234 | lutuv = v->last_lutuv; |
| 235 | 235 | use_ic = v->last_use_ic; |
| 236 | 236 | interlace = !!(s->last_pic.f->flags & AV_FRAME_FLAG_INTERLACED); |
| 237 | 237 | } |
| 238 | 238 | } else { |
| 239 | − srcY = s->next_pic.f->data[0]; | |
| 240 | − srcU = s->next_pic.f->data[1]; | |
| 241 | − srcV = s->next_pic.f->data[2]; | |
| 239 | + srcY = s->next_pic.data[0]; | |
| 240 | + srcU = s->next_pic.data[1]; | |
| 241 | + srcV = s->next_pic.data[2]; | |
| 242 | 242 | luty = v->next_luty; |
| 243 | 243 | lutuv = v->next_lutuv; |
| 244 | 244 | use_ic = v->next_use_ic; |
| @@ -464,7 +464,7 @@ void ff_vc1_mc_4mv_luma(VC1Context *v, int n, int dir, int avg) · 219 unmodified lines | ||
| 464 | 464 | |
| 465 | 465 | if ((!v->field_mode || |
| 466 | 466 | (v->ref_field_type[dir] == 1 && v->cur_field_type == 1)) && |
| 467 | − !v->s.last_pic.f->data[0]) | |
| 467 | + !v->s.last_pic.data[0]) | |
| 468 | 468 | return; |
| 469 | 469 | |
| 470 | 470 | linesize = s->cur_pic_ptr->f->linesize[0]; |
| @@ -474,18 +474,18 @@ void ff_vc1_mc_4mv_luma(VC1Context *v, int n, int dir, int avg) · 3 unmodified lines | ||
| 474 | 474 | |
| 475 | 475 | if (!dir) { |
| 476 | 476 | if (v->field_mode && (v->cur_field_type != v->ref_field_type[dir]) && v->second_field) { |
| 477 | − srcY = s->cur_pic.f->data[0]; | |
| 477 | + srcY = s->cur_pic.data[0]; | |
| 478 | 478 | luty = v->curr_luty; |
| 479 | 479 | use_ic = *v->curr_use_ic; |
| 480 | 480 | interlace = 1; |
| 481 | 481 | } else { |
| 482 | − srcY = s->last_pic.f->data[0]; | |
| 482 | + srcY = s->last_pic.data[0]; | |
| 483 | 483 | luty = v->last_luty; |
| 484 | 484 | use_ic = v->last_use_ic; |
| 485 | 485 | interlace = !!(s->last_pic.f->flags & AV_FRAME_FLAG_INTERLACED); |
| 486 | 486 | } |
| 487 | 487 | } else { |
| 488 | − srcY = s->next_pic.f->data[0]; | |
| 488 | + srcY = s->next_pic.data[0]; | |
| 489 | 489 | luty = v->next_luty; |
| 490 | 490 | use_ic = v->next_use_ic; |
| 491 | 491 | interlace = !!(s->next_pic.f->flags & AV_FRAME_FLAG_INTERLACED); |
| @@ -645,7 +645,7 @@ void ff_vc1_mc_4mv_chroma(VC1Context *v, int dir) · 153 unmodified lines | ||
| 645 | 645 | int interlace; |
| 646 | 646 | int uvlinesize; |
| 647 | 647 | |
| 648 | − if (!v->field_mode && !v->s.last_pic.f->data[0]) | |
| 648 | + if (!v->field_mode && !v->s.last_pic.data[0]) | |
| 649 | 649 | return; |
| 650 | 650 | if (CONFIG_GRAY && s->avctx->flags & AV_CODEC_FLAG_GRAY) |
| 651 | 651 | return; |
| @@ -664,7 +664,7 @@ void ff_vc1_mc_4mv_chroma(VC1Context *v, int dir) · 12 unmodified lines | ||
| 664 | 664 | int opp_count = get_luma_mv(v, dir, &tx, &ty); |
| 665 | 665 | chroma_ref_type = v->cur_field_type ^ (opp_count > 2); |
| 666 | 666 | } |
| 667 | − if (v->field_mode && chroma_ref_type == 1 && v->cur_field_type == 1 && !v->s.last_pic.f->data[0]) | |
| 667 | + if (v->field_mode && chroma_ref_type == 1 && v->cur_field_type == 1 && !v->s.last_pic.data[0]) | |
| 668 | 668 | return; |
| 669 | 669 | s->cur_pic.motion_val[1][s->block_index[0] + v->blocks_off][0] = tx; |
| 670 | 670 | s->cur_pic.motion_val[1][s->block_index[0] + v->blocks_off][1] = ty; |
| @@ -698,21 +698,21 @@ void ff_vc1_mc_4mv_chroma(VC1Context *v, int dir) · 27 unmodified lines | ||
| 698 | 698 | |
| 699 | 699 | if (!dir) { |
| 700 | 700 | if (v->field_mode && (v->cur_field_type != chroma_ref_type) && v->second_field) { |
| 701 | − srcU = s->cur_pic.f->data[1]; | |
| 702 | − srcV = s->cur_pic.f->data[2]; | |
| 701 | + srcU = s->cur_pic.data[1]; | |
| 702 | + srcV = s->cur_pic.data[2]; | |
| 703 | 703 | lutuv = v->curr_lutuv; |
| 704 | 704 | use_ic = *v->curr_use_ic; |
| 705 | 705 | interlace = 1; |
| 706 | 706 | } else { |
| 707 | − srcU = s->last_pic.f->data[1]; | |
| 708 | − srcV = s->last_pic.f->data[2]; | |
| 707 | + srcU = s->last_pic.data[1]; | |
| 708 | + srcV = s->last_pic.data[2]; | |
| 709 | 709 | lutuv = v->last_lutuv; |
| 710 | 710 | use_ic = v->last_use_ic; |
| 711 | 711 | interlace = !!(s->last_pic.f->flags & AV_FRAME_FLAG_INTERLACED); |
| 712 | 712 | } |
| 713 | 713 | } else { |
| 714 | − srcU = s->next_pic.f->data[1]; | |
| 715 | − srcV = s->next_pic.f->data[2]; | |
| 714 | + srcU = s->next_pic.data[1]; | |
| 715 | + srcV = s->next_pic.data[2]; | |
| 716 | 716 | lutuv = v->next_lutuv; |
| 717 | 717 | use_ic = v->next_use_ic; |
| 718 | 718 | interlace = !!(s->next_pic.f->flags & AV_FRAME_FLAG_INTERLACED); |
| @@ -880,14 +880,14 @@ void ff_vc1_mc_4mv_chroma4(VC1Context *v, int dir, int dir2, int avg) · 161 unmodified lines | ||
| 880 | 880 | else |
| 881 | 881 | uvsrc_y = av_clip(uvsrc_y, -8, s->avctx->coded_height >> 1); |
| 882 | 882 | if (i < 2 ? dir : dir2) { |
| 883 | − srcU = s->next_pic.f->data[1]; | |
| 884 | − srcV = s->next_pic.f->data[2]; | |
| 883 | + srcU = s->next_pic.data[1]; | |
| 884 | + srcV = s->next_pic.data[2]; | |
| 885 | 885 | lutuv = v->next_lutuv; |
| 886 | 886 | use_ic = v->next_use_ic; |
| 887 | 887 | interlace = !!(s->next_pic.f->flags & AV_FRAME_FLAG_INTERLACED); |
| 888 | 888 | } else { |
| 889 | − srcU = s->last_pic.f->data[1]; | |
| 890 | − srcV = s->last_pic.f->data[2]; | |
| 889 | + srcU = s->last_pic.data[1]; | |
| 890 | + srcV = s->last_pic.data[2]; | |
| 891 | 891 | lutuv = v->last_lutuv; |
| 892 | 892 | use_ic = v->last_use_ic; |
| 893 | 893 | interlace = !!(s->last_pic.f->flags & AV_FRAME_FLAG_INTERLACED); |
| @@ -1012,7 +1012,7 @@ void ff_vc1_interp_mc(VC1Context *v) · 118 unmodified lines | ||
| 1012 | 1012 | int interlace; |
| 1013 | 1013 | int linesize, uvlinesize; |
| 1014 | 1014 | |
| 1015 | − if (!v->field_mode && !v->s.next_pic.f->data[0]) | |
| 1015 | + if (!v->field_mode && !v->s.next_pic.data[0]) | |
| 1016 | 1016 | return; |
| 1017 | 1017 | |
| 1018 | 1018 | linesize = s->cur_pic_ptr->f->linesize[0]; |
| @@ -1030,9 +1030,9 @@ void ff_vc1_interp_mc(VC1Context *v) · 11 unmodified lines | ||
| 1030 | 1030 | uvmx = uvmx + ((uvmx < 0) ? -(uvmx & 1) : (uvmx & 1)); |
| 1031 | 1031 | uvmy = uvmy + ((uvmy < 0) ? -(uvmy & 1) : (uvmy & 1)); |
| 1032 | 1032 | } |
| 1033 | − srcY = s->next_pic.f->data[0]; | |
| 1034 | − srcU = s->next_pic.f->data[1]; | |
| 1035 | − srcV = s->next_pic.f->data[2]; | |
| 1033 | + srcY = s->next_pic.data[0]; | |
| 1034 | + srcU = s->next_pic.data[1]; | |
| 1035 | + srcV = s->next_pic.data[2]; | |
| 1036 | 1036 | |
| 1037 | 1037 | interlace = !!(s->next_pic.f->flags & AV_FRAME_FLAG_INTERLACED); |
| 1038 | 1038 | |
| @@ -235,15 +235,15 @@ static void vc1_draw_sprites(VC1Context *v, SpriteData* sd) · 234 unmodified lines | ||
| 235 | 235 | v->sprite_output_frame->linesize[plane] * row; |
| 236 | 236 | |
| 237 | 237 | for (sprite = 0; sprite <= v->two_sprites; sprite++) { |
| 238 | − uint8_t *iplane = s->cur_pic.f->data[plane]; | |
| 239 | − int iline = s->cur_pic.f->linesize[plane]; | |
| 238 | + uint8_t *iplane = s->cur_pic.data[plane]; | |
| 239 | + int iline = s->cur_pic.linesize[plane]; | |
| 240 | 240 | int ycoord = yoff[sprite] + yadv[sprite] * row; |
| 241 | 241 | int yline = ycoord >> 16; |
| 242 | 242 | int next_line; |
| 243 | 243 | ysub[sprite] = ycoord & 0xFFFF; |
| 244 | 244 | if (sprite) { |
| 245 | − iplane = s->last_pic.f->data[plane]; | |
| 246 | − iline = s->last_pic.f->linesize[plane]; | |
| 245 | + iplane = s->last_pic.data[plane]; | |
| 246 | + iline = s->last_pic.linesize[plane]; | |
| 247 | 247 | } |
| 248 | 248 | next_line = FFMIN(yline + 1, (v->sprite_height >> !!plane) - 1) * iline; |
| 249 | 249 | if (!(xoff[sprite] & 0xFFFF) && xadv[sprite] == 1 << 16) { |
| @@ -317,12 +317,12 @@ static int vc1_decode_sprites(VC1Context *v, GetBitContext* gb) · 67 unmodified lines | ||
| 317 | 317 | if (ret < 0) |
| 318 | 318 | return ret; |
| 319 | 319 | |
| 320 | − if (!s->cur_pic.f || !s->cur_pic.f->data[0]) { | |
| 320 | + if (!s->cur_pic.data[0]) { | |
| 321 | 321 | av_log(avctx, AV_LOG_ERROR, "Got no sprites\n"); |
| 322 | 322 | return AVERROR_UNKNOWN; |
| 323 | 323 | } |
| 324 | 324 | |
| 325 | − if (v->two_sprites && (!s->last_pic_ptr || !s->last_pic.f->data[0])) { | |
| 325 | + if (v->two_sprites && (!s->last_pic_ptr || !s->last_pic.data[0])) { | |
| 326 | 326 | av_log(avctx, AV_LOG_WARNING, "Need two sprites, only got one\n"); |
| 327 | 327 | v->two_sprites = 0; |
| 328 | 328 | } |
| @@ -340,14 +340,14 @@ static void vc1_sprite_flush(AVCodecContext *avctx) · 11 unmodified lines | ||
| 340 | 340 | { |
| 341 | 341 | VC1Context *v = avctx->priv_data; |
| 342 | 342 | MpegEncContext *s = &v->s; |
| 343 | − AVFrame *f = s->cur_pic.f; | |
| 343 | + Picture *f = &s->cur_pic; | |
| 344 | 344 | int plane, i; |
| 345 | 345 | |
| 346 | 346 | /* Windows Media Image codecs have a convergence interval of two keyframes. |
| 347 | 347 | Since we can't enforce it, clear to black the missing sprite. This is |
| 348 | 348 | wrong but it looks better than doing nothing. */ |
| 349 | 349 | |
| 350 | − if (f && f->data[0]) | |
| 350 | + if (f->data[0]) | |
| 351 | 351 | for (plane = 0; plane < (CONFIG_GRAY && s->avctx->flags & AV_CODEC_FLAG_GRAY ? 1 : 3); plane++) |
| 352 | 352 | for (i = 0; i < v->sprite_height>>!!plane; i++) |
| 353 | 353 | memset(f->data[plane] + i * f->linesize[plane], |
| @@ -1230,9 +1230,9 @@ static int vc1_decode_frame(AVCodecContext *avctx, AVFrame *pict, · 876 unmodified lines | ||
| 1230 | 1230 | |
| 1231 | 1231 | v->end_mb_x = s->mb_width; |
| 1232 | 1232 | if (v->field_mode) { |
| 1233 | − s->cur_pic.f->linesize[0] <<= 1; | |
| 1234 | − s->cur_pic.f->linesize[1] <<= 1; | |
| 1235 | − s->cur_pic.f->linesize[2] <<= 1; | |
| 1233 | + s->cur_pic.linesize[0] <<= 1; | |
| 1234 | + s->cur_pic.linesize[1] <<= 1; | |
| 1235 | + s->cur_pic.linesize[2] <<= 1; | |
| 1236 | 1236 | s->linesize <<= 1; |
| 1237 | 1237 | s->uvlinesize <<= 1; |
| 1238 | 1238 | } |
| @@ -1307,9 +1307,9 @@ static int vc1_decode_frame(AVCodecContext *avctx, AVFrame *pict, · 68 unmodified lines | ||
| 1307 | 1307 | } |
| 1308 | 1308 | if (v->field_mode) { |
| 1309 | 1309 | v->second_field = 0; |
| 1310 | − s->cur_pic.f->linesize[0] >>= 1; | |
| 1311 | − s->cur_pic.f->linesize[1] >>= 1; | |
| 1312 | − s->cur_pic.f->linesize[2] >>= 1; | |
| 1310 | + s->cur_pic.linesize[0] >>= 1; | |
| 1311 | + s->cur_pic.linesize[1] >>= 1; | |
| 1312 | + s->cur_pic.linesize[2] >>= 1; | |
| 1313 | 1313 | s->linesize >>= 1; |
| 1314 | 1314 | s->uvlinesize >>= 1; |
| 1315 | 1315 | if (v->s.pict_type != AV_PICTURE_TYPE_BI && v->s.pict_type != AV_PICTURE_TYPE_B) { |