};
const enum PixelFormat ff_hwaccel_pixfmt_list_420[] = {
+ PIX_FMT_DXVA2_VLD,
PIX_FMT_VAAPI_VLD,
PIX_FMT_YUV420P,
PIX_FMT_NONE
}
}
}
-alloc:
+
if(!s->encoding){
/* release non reference frames */
for(i=0; i<MAX_PICTURE_COUNT; i++){
s->current_picture_ptr ? s->current_picture_ptr->data[0] : NULL,
s->pict_type, s->dropable);*/
+ if(s->codec_id != CODEC_ID_H264){
+ if((s->last_picture_ptr==NULL || s->last_picture_ptr->data[0]==NULL) && s->pict_type!=FF_I_TYPE){
+ av_log(avctx, AV_LOG_ERROR, "warning: first frame is no keyframe\n");
+ /* Allocate a dummy frame */
+ i= ff_find_unused_picture(s, 0);
+ s->last_picture_ptr= &s->picture[i];
+ if(ff_alloc_picture(s, s->last_picture_ptr, 0) < 0)
+ return -1;
+ }
+ if((s->next_picture_ptr==NULL || s->next_picture_ptr->data[0]==NULL) && s->pict_type==FF_B_TYPE){
+ /* Allocate a dummy frame */
+ i= ff_find_unused_picture(s, 0);
+ s->next_picture_ptr= &s->picture[i];
+ if(ff_alloc_picture(s, s->next_picture_ptr, 0) < 0)
+ return -1;
+ }
+ }
+
if(s->last_picture_ptr) ff_copy_picture(&s->last_picture, s->last_picture_ptr);
if(s->next_picture_ptr) ff_copy_picture(&s->next_picture, s->next_picture_ptr);
- if(s->pict_type != FF_I_TYPE && (s->last_picture_ptr==NULL || s->last_picture_ptr->data[0]==NULL) && !s->dropable && s->codec_id != CODEC_ID_H264){
- av_log(avctx, AV_LOG_ERROR, "warning: first frame is no keyframe\n");
- assert(s->pict_type != FF_B_TYPE); //these should have been dropped if we don't have a reference
- goto alloc;
- }
-
assert(s->pict_type == FF_I_TYPE || (s->last_picture_ptr && s->last_picture_ptr->data[0]));
if(s->picture_structure!=PICT_FRAME && s->out_format != FMT_H264){
int motion_x, int motion_y)
{
const int lowres= s->avctx->lowres;
+ const int op_index= FFMIN(lowres, 2);
const int s_mask= (2<<lowres)-1;
int emu=0;
int sx, sy;
emu=1;
}
- sx <<= 2 - lowres;
- sy <<= 2 - lowres;
+ sx= (sx << 2) >> lowres;
+ sy= (sy << 2) >> lowres;
if(field_select)
src += s->linesize;
- pix_op[lowres](dest, src, stride, h, sx, sy);
+ pix_op[op_index](dest, src, stride, h, sx, sy);
return emu;
}
uint8_t *ptr_y, *ptr_cb, *ptr_cr;
int mx, my, src_x, src_y, uvsrc_x, uvsrc_y, uvlinesize, linesize, sx, sy, uvsx, uvsy;
const int lowres= s->avctx->lowres;
+ const int op_index= FFMIN(lowres, 2);
const int block_s= 8>>lowres;
const int s_mask= (2<<lowres)-1;
const int h_edge_pos = s->h_edge_pos >> lowres;
ptr_cr+= s->uvlinesize;
}
- sx <<= 2 - lowres;
- sy <<= 2 - lowres;
+ sx= (sx << 2) >> lowres;
+ sy= (sy << 2) >> lowres;
pix_op[lowres-1](dest_y, ptr_y, linesize, h, sx, sy);
if(!CONFIG_GRAY || !(s->flags&CODEC_FLAG_GRAY)){
- uvsx <<= 2 - lowres;
- uvsy <<= 2 - lowres;
- pix_op[lowres](dest_cb, ptr_cb, uvlinesize, h >> s->chroma_y_shift, uvsx, uvsy);
- pix_op[lowres](dest_cr, ptr_cr, uvlinesize, h >> s->chroma_y_shift, uvsx, uvsy);
+ uvsx= (uvsx << 2) >> lowres;
+ uvsy= (uvsy << 2) >> lowres;
+ pix_op[op_index](dest_cb, ptr_cb, uvlinesize, h >> s->chroma_y_shift, uvsx, uvsy);
+ pix_op[op_index](dest_cr, ptr_cr, uvlinesize, h >> s->chroma_y_shift, uvsx, uvsy);
}
//FIXME h261 lowres loop filter
}
h264_chroma_mc_func *pix_op,
int mx, int my){
const int lowres= s->avctx->lowres;
+ const int op_index= FFMIN(lowres, 2);
const int block_s= 8>>lowres;
const int s_mask= (2<<lowres)-1;
const int h_edge_pos = s->h_edge_pos >> (lowres+1);
emu=1;
}
}
- sx <<= 2 - lowres;
- sy <<= 2 - lowres;
- pix_op[lowres](dest_cb, ptr, s->uvlinesize, block_s, sx, sy);
+ sx= (sx << 2) >> lowres;
+ sy= (sy << 2) >> lowres;
+ pix_op[op_index](dest_cb, ptr, s->uvlinesize, block_s, sx, sy);
ptr = ref_picture[2] + offset;
if(emu){
ff_emulated_edge_mc(s->edge_emu_buffer, ptr, s->uvlinesize, 9, 9, src_x, src_y, h_edge_pos, v_edge_pos);
ptr= s->edge_emu_buffer;
}
- pix_op[lowres](dest_cr, ptr, s->uvlinesize, block_s, sx, sy);
+ pix_op[op_index](dest_cr, ptr, s->uvlinesize, block_s, sx, sy);
}
/**
}
}//fi gray
}
- else if (CONFIG_WMV2) {
+ else if (CONFIG_WMV2_DECODER || CONFIG_WMV2_ENCODER) {
ff_wmv2_add_mb(s, block, dest_y, dest_cb, dest_cr);
}
} else {