}
/* release last B frame */
if(h->picture.f.data[0])
- s->avctx->release_buffer(s->avctx, (AVFrame *)&h->picture);
+ s->avctx->release_buffer(s->avctx, &h->picture.f);
- s->avctx->get_buffer(s->avctx, (AVFrame *)&h->picture);
+ s->avctx->get_buffer(s->avctx, &h->picture.f);
ff_cavs_init_pic(h);
h->picture.poc = get_bits(&s->gb,8)*2;
}
if(h->pic_type != AV_PICTURE_TYPE_B) {
if(h->DPB[1].f.data[0])
- s->avctx->release_buffer(s->avctx, (AVFrame *)&h->DPB[1]);
+ s->avctx->release_buffer(s->avctx, &h->DPB[1].f);
h->DPB[1] = h->DPB[0];
h->DPB[0] = h->picture;
memset(&h->picture,0,sizeof(Picture));
case PIC_I_START_CODE:
if(!h->got_keyframe) {
if(h->DPB[0].f.data[0])
- avctx->release_buffer(avctx, (AVFrame *)&h->DPB[0]);
+ avctx->release_buffer(avctx, &h->DPB[0].f);
if(h->DPB[1].f.data[0])
- avctx->release_buffer(avctx, (AVFrame *)&h->DPB[1]);
+ avctx->release_buffer(avctx, &h->DPB[1].f);
h->got_keyframe = 1;
}
case PIC_PB_START_CODE:
if (s->avctx->codec_id == CODEC_ID_H264) {
// FIXME
} else {
- ff_thread_await_progress((AVFrame *) s->last_picture_ptr,
+ ff_thread_await_progress(&s->last_picture_ptr->f,
mb_y, 0);
}
if (!s->last_picture.f.motion_val[0] ||
if (s->avctx->codec_id == CODEC_ID_H264) {
// FIXME
} else {
- ff_thread_await_progress((AVFrame *) s->last_picture_ptr,
+ ff_thread_await_progress(&s->last_picture_ptr->f,
mb_y, 0);
}
is_intra_likely += s->dsp.sad[0](NULL, last_mb_ptr, mb_ptr,
if (s->avctx->codec_id == CODEC_ID_H264) {
// FIXME
} else {
- ff_thread_await_progress((AVFrame *) s->next_picture_ptr, mb_y, 0);
+ ff_thread_await_progress(&s->next_picture_ptr->f, mb_y, 0);
}
s->mv[0][0][0] = s->next_picture.f.motion_val[0][xy][0] * time_pb / time_pp;
s->mv[0][0][1] = s->next_picture.f.motion_val[0][xy][1] * time_pb / time_pp;
nrefs[list]--;
if(!FIELD_PICTURE && ref_field_picture){ // frame referencing two fields
- ff_thread_await_progress((AVFrame*)ref_pic, FFMIN((row >> 1) - !(row&1), pic_height-1), 1);
- ff_thread_await_progress((AVFrame*)ref_pic, FFMIN((row >> 1) , pic_height-1), 0);
+ ff_thread_await_progress(&ref_pic->f,
+ FFMIN((row >> 1) - !(row & 1),
+ pic_height - 1),
+ 1);
+ ff_thread_await_progress(&ref_pic->f,
+ FFMIN((row >> 1), pic_height - 1),
+ 0);
}else if(FIELD_PICTURE && !ref_field_picture){ // field referencing one field of a frame
- ff_thread_await_progress((AVFrame*)ref_pic, FFMIN(row*2 + ref_field , pic_height-1), 0);
+ ff_thread_await_progress(&ref_pic->f,
+ FFMIN(row * 2 + ref_field,
+ pic_height - 1),
+ 0);
}else if(FIELD_PICTURE){
- ff_thread_await_progress((AVFrame*)ref_pic, FFMIN(row, pic_height-1), ref_field);
+ ff_thread_await_progress(&ref_pic->f,
+ FFMIN(row, pic_height - 1),
+ ref_field);
}else{
- ff_thread_await_progress((AVFrame*)ref_pic, FFMIN(row, pic_height-1), 0);
+ ff_thread_await_progress(&ref_pic->f,
+ FFMIN(row, pic_height - 1),
+ 0);
}
}
}
s->mb_y= 0;
if (!in_setup && !s->dropable)
- ff_thread_report_progress((AVFrame*)s->current_picture_ptr, (16*s->mb_height >> FIELD_PICTURE) - 1,
- s->picture_structure==PICT_BOTTOM_FIELD);
+ ff_thread_report_progress(&s->current_picture_ptr->f,
+ (16 * s->mb_height >> FIELD_PICTURE) - 1,
+ s->picture_structure == PICT_BOTTOM_FIELD);
if (CONFIG_H264_VDPAU_DECODER && s->avctx->codec->capabilities&CODEC_CAP_HWACCEL_VDPAU)
ff_vdpau_h264_set_reference_frames(s);
h->prev_frame_num++;
h->prev_frame_num %= 1<<h->sps.log2_max_frame_num;
s->current_picture_ptr->frame_num= h->prev_frame_num;
- ff_thread_report_progress((AVFrame*)s->current_picture_ptr, INT_MAX, 0);
- ff_thread_report_progress((AVFrame*)s->current_picture_ptr, INT_MAX, 1);
+ ff_thread_report_progress(&s->current_picture_ptr->f, INT_MAX, 0);
+ ff_thread_report_progress(&s->current_picture_ptr->f, INT_MAX, 1);
ff_generate_sliding_window_mmcos(h);
if (ff_h264_execute_ref_pic_marking(h, h->mmco, h->mmco_index) < 0 &&
(s->avctx->err_recognition & AV_EF_EXPLODE))
if (s->dropable) return;
- ff_thread_report_progress((AVFrame*)s->current_picture_ptr, top + height - 1,
- s->picture_structure==PICT_BOTTOM_FIELD);
+ ff_thread_report_progress(&s->current_picture_ptr->f, top + height - 1,
+ s->picture_structure == PICT_BOTTOM_FIELD);
}
static int decode_slice(struct AVCodecContext *avctx, void *arg){
//FIXME it can be safe to access mb stuff
//even if pixels aren't deblocked yet
- ff_thread_await_progress((AVFrame*)ref, FFMIN(16*mb_y >> ref_field_picture, ref_height-1),
+ ff_thread_await_progress(&ref->f,
+ FFMIN(16 * mb_y >> ref_field_picture,
+ ref_height - 1),
ref_field_picture && ref_field);
}
MJpegContext * const m = s->mjpeg_ctx;
const int width= s->width;
const int height= s->height;
- AVFrame * const p= (AVFrame*)&s->current_picture;
+ AVFrame * const p = &s->current_picture.f;
const int predictor= avctx->prediction_method+1;
const int mb_width = (width + s->mjpeg_hsample[0] - 1) / s->mjpeg_hsample[0];
const int mb_height = (height + s->mjpeg_vsample[0] - 1) / s->mjpeg_vsample[0];
int mb_x = 0, mb_y = 0;
while (s->next_picture.f.mbskip_table[s->mb_index2xy[mb_num]]) {
- if (!mb_x) ff_thread_await_progress((AVFrame*)s->next_picture_ptr, mb_y++, 0);
+ if (!mb_x)
+ ff_thread_await_progress(&s->next_picture_ptr->f, mb_y++, 0);
mb_num++;
if (++mb_x == s->mb_width) mb_x = 0;
}
s->last_mv[i][1][1]= 0;
}
- ff_thread_await_progress((AVFrame*)s->next_picture_ptr, s->mb_y, 0);
+ ff_thread_await_progress(&s->next_picture_ptr->f, s->mb_y, 0);
}
/* if we skipped it in the future P Frame than skip it now too */
const int delta= s->mb_x + 1 == s->mb_width ? 2 : 1;
if (s->pict_type == AV_PICTURE_TYPE_B && s->next_picture.f.mbskip_table[xy + delta]) {
- ff_thread_await_progress((AVFrame*)s->next_picture_ptr,
+ ff_thread_await_progress(&s->next_picture_ptr->f,
(s->mb_x + delta >= s->mb_width) ? FFMIN(s->mb_y+1, s->mb_height-1) : s->mb_y, 0);
}
* dimensions; ignore user defined callbacks for these
*/
if (s->codec_id != CODEC_ID_WMV3IMAGE && s->codec_id != CODEC_ID_VC1IMAGE)
- ff_thread_release_buffer(s->avctx, (AVFrame *) pic);
+ ff_thread_release_buffer(s->avctx, &pic->f);
else
- avcodec_default_release_buffer(s->avctx, (AVFrame *) pic);
+ avcodec_default_release_buffer(s->avctx, &pic->f);
av_freep(&pic->f.hwaccel_picture_private);
}
}
if (s->codec_id != CODEC_ID_WMV3IMAGE && s->codec_id != CODEC_ID_VC1IMAGE)
- r = ff_thread_get_buffer(s->avctx, (AVFrame *) pic);
+ r = ff_thread_get_buffer(s->avctx, &pic->f);
else
- r = avcodec_default_get_buffer(s->avctx, (AVFrame *) pic);
+ r = avcodec_default_get_buffer(s->avctx, &pic->f);
if (r < 0 || !pic->f.type || !pic->f.data[0]) {
av_log(s->avctx, AV_LOG_ERROR, "get_buffer() failed (%d %d %p)\n",
s->stream_codec_tag = avpriv_toupper4(s->avctx->stream_codec_tag);
- s->avctx->coded_frame = (AVFrame *)&s->current_picture;
+ s->avctx->coded_frame = &s->current_picture.f;
FF_ALLOCZ_OR_GOTO(s->avctx, s->mb_index2xy, (s->mb_num + 1) * sizeof(int),
fail); // error ressilience code looks cleaner with this
FF_ALLOCZ_OR_GOTO(s->avctx, s->picture,
s->picture_count * sizeof(Picture), fail);
for (i = 0; i < s->picture_count; i++) {
- avcodec_get_frame_defaults((AVFrame *) &s->picture[i]);
+ avcodec_get_frame_defaults(&s->picture[i].f);
}
if (s->width && s->height) {
s->last_picture_ptr = &s->picture[i];
if (ff_alloc_picture(s, s->last_picture_ptr, 0) < 0)
return -1;
- ff_thread_report_progress((AVFrame *) s->last_picture_ptr,
- INT_MAX, 0);
- ff_thread_report_progress((AVFrame *) s->last_picture_ptr,
- INT_MAX, 1);
+ ff_thread_report_progress(&s->last_picture_ptr->f, INT_MAX, 0);
+ ff_thread_report_progress(&s->last_picture_ptr->f, INT_MAX, 1);
}
if ((s->next_picture_ptr == NULL ||
s->next_picture_ptr->f.data[0] == NULL) &&
s->next_picture_ptr = &s->picture[i];
if (ff_alloc_picture(s, s->next_picture_ptr, 0) < 0)
return -1;
- ff_thread_report_progress((AVFrame *) s->next_picture_ptr,
- INT_MAX, 0);
- ff_thread_report_progress((AVFrame *) s->next_picture_ptr,
- INT_MAX, 1);
+ ff_thread_report_progress(&s->next_picture_ptr->f, INT_MAX, 0);
+ ff_thread_report_progress(&s->next_picture_ptr->f, INT_MAX, 1);
}
}
memset(&s->next_picture, 0, sizeof(Picture));
memset(&s->current_picture, 0, sizeof(Picture));
#endif
- s->avctx->coded_frame = (AVFrame *) s->current_picture_ptr;
+ s->avctx->coded_frame = &s->current_picture_ptr->f;
if (s->codec_id != CODEC_ID_H264 && s->current_picture.f.reference) {
- ff_thread_report_progress((AVFrame *) s->current_picture_ptr,
+ ff_thread_report_progress(&s->current_picture_ptr->f,
s->mb_height - 1, 0);
}
}
if(HAVE_THREADS && s->avctx->active_thread_type&FF_THREAD_FRAME) {
if (s->mv_dir & MV_DIR_FORWARD) {
- ff_thread_await_progress((AVFrame*)s->last_picture_ptr, ff_MPV_lowest_referenced_row(s, 0), 0);
+ ff_thread_await_progress(&s->last_picture_ptr->f,
+ ff_MPV_lowest_referenced_row(s, 0),
+ 0);
}
if (s->mv_dir & MV_DIR_BACKWARD) {
- ff_thread_await_progress((AVFrame*)s->next_picture_ptr, ff_MPV_lowest_referenced_row(s, 1), 0);
+ ff_thread_await_progress(&s->next_picture_ptr->f,
+ ff_MPV_lowest_referenced_row(s, 1),
+ 0);
}
}
int i;
if(s->pict_type==AV_PICTURE_TYPE_B || s->low_delay || (s->avctx->slice_flags&SLICE_FLAG_CODED_ORDER))
- src= (AVFrame*)s->current_picture_ptr;
+ src = &s->current_picture_ptr->f;
else if(s->last_picture_ptr)
- src= (AVFrame*)s->last_picture_ptr;
+ src = &s->last_picture_ptr->f;
else
return;
void ff_MPV_report_decode_progress(MpegEncContext *s)
{
if (s->pict_type != AV_PICTURE_TYPE_B && !s->partitioned_frame && !s->error_occurred)
- ff_thread_report_progress((AVFrame*)s->current_picture_ptr, s->mb_y, 0);
+ ff_thread_report_progress(&s->current_picture_ptr->f, s->mb_y, 0);
}
if (i < 0)
return i;
- pic = (AVFrame *) &s->picture[i];
+ pic = &s->picture[i].f;
pic->reference = 3;
for (i = 0; i < 4; i++) {
if (i < 0)
return i;
- pic = (AVFrame *) &s->picture[i];
+ pic = &s->picture[i].f;
pic->reference = 3;
if (ff_alloc_picture(s, (Picture *) pic, 0) < 0) {
s->input_picture[0]->f.type == FF_BUFFER_TYPE_INTERNAL);
s->avctx->release_buffer(s->avctx,
- (AVFrame *) s->input_picture[0]);
+ &s->input_picture[0]->f);
}
emms_c();
/* mark us unused / free shared pic */
if (s->reordered_input_picture[0]->f.type == FF_BUFFER_TYPE_INTERNAL)
s->avctx->release_buffer(s->avctx,
- (AVFrame *) s->reordered_input_picture[0]);
+ &s->reordered_input_picture[0]->f);
for (i = 0; i < 4; i++)
s->reordered_input_picture[0]->f.data[i] = NULL;
s->reordered_input_picture[0]->f.type = 0;
- copy_picture_attributes(s, (AVFrame *) pic,
- (AVFrame *) s->reordered_input_picture[0]);
+ copy_picture_attributes(s, &pic->f,
+ &s->reordered_input_picture[0]->f);
s->current_picture_ptr = pic;
} else {