}
if(pic->linesize[1] != pic->linesize[2]){
- av_log(s->avctx, AV_LOG_ERROR, "get_buffer() failed (uv stride missmatch)\n");
+ av_log(s->avctx, AV_LOG_ERROR, "get_buffer() failed (uv stride mismatch)\n");
return -1;
}
COPY(lambda2);
COPY(picture_in_gop_number);
COPY(gop_picture_number);
- COPY(frame_pred_frame_dct); //FIXME dont set in encode_header
- COPY(progressive_frame); //FIXME dont set in encode_header
- COPY(partitioned_frame); //FIXME dont set in encode_header
+ COPY(frame_pred_frame_dct); //FIXME don't set in encode_header
+ COPY(progressive_frame); //FIXME don't set in encode_header
+ COPY(partitioned_frame); //FIXME don't set in encode_header
#undef COPY
}
}
alloc:
if(!s->encoding){
- /* release non refernce frames */
+ /* release non reference frames */
for(i=0; i<MAX_PICTURE_COUNT; i++){
if(s->picture[i].data[0] && !s->picture[i].reference /*&& s->picture[i].type!=FF_BUFFER_TYPE_SHARED*/){
s->avctx->release_buffer(s->avctx, (AVFrame*)&s->picture[i]);
if(s->pict_type != I_TYPE && (s->last_picture_ptr==NULL || s->last_picture_ptr->data[0]==NULL)){
av_log(avctx, AV_LOG_ERROR, "warning: first frame is no keyframe\n");
- assert(s->pict_type != B_TYPE); //these should have been dropped if we dont have a reference
+ assert(s->pict_type != B_TYPE); //these should have been dropped if we don't have a reference
goto alloc;
}
s->hurry_up= s->avctx->hurry_up;
s->error_resilience= avctx->error_resilience;
- /* set dequantizer, we cant do it during init as it might change for mpeg4
- and we cant do it in the header decode as init isnt called for mpeg4 there yet */
+ /* set dequantizer, we can't do it during init as it might change for mpeg4
+ and we can't do it in the header decode as init isnt called for mpeg4 there yet */
if(s->mpeg_quant || s->codec_id == CODEC_ID_MPEG2VIDEO){
s->dct_unquantize_intra = s->dct_unquantize_mpeg2_intra;
s->dct_unquantize_inter = s->dct_unquantize_mpeg2_inter;
#endif
if(s->encoding){
- /* release non refernce frames */
+ /* release non-reference frames */
for(i=0; i<MAX_PICTURE_COUNT; i++){
if(s->picture[i].data[0] && !s->picture[i].reference /*&& s->picture[i].type!=FF_BUFFER_TYPE_SHARED*/){
s->avctx->release_buffer(s->avctx, (AVFrame*)&s->picture[i]);
s->reordered_input_picture[i-1]= s->reordered_input_picture[i];
s->reordered_input_picture[MAX_PICTURE_COUNT-1]= NULL;
- /* set next picture types & ordering */
+ /* set next picture type & ordering */
if(s->reordered_input_picture[0]==NULL && s->input_picture[0]){
if(/*s->picture_in_gop_number >= s->gop_size ||*/ s->next_picture_ptr==NULL || s->intra_only){
s->reordered_input_picture[0]= s->input_picture[0];
s->input_picture[i-1]->data[0], s->linesize) + 1;
}
}
- for(i=0; i<s->max_b_frames; i++){
+ for(i=0; i<s->max_b_frames+1; i++){
if(s->input_picture[i]==NULL || s->input_picture[i]->b_frame_score - 1 > s->mb_num/40) break;
}
copy_picture(&s->new_picture, s->reordered_input_picture[0]);
if(s->reordered_input_picture[0]->type == FF_BUFFER_TYPE_SHARED){
- // input is a shared pix, so we cant modifiy it -> alloc a new one & ensure that the shared one is reuseable
+ // input is a shared pix, so we can't modifiy it -> alloc a new one & ensure that the shared one is reuseable
int i= ff_find_unused_picture(s, 0);
Picture *pic= &s->picture[i];
int start_y= s->thread_context[i]->start_mb_y;
int end_y= s->thread_context[i]-> end_mb_y;
int h= s->mb_height;
- uint8_t *start= buf + buf_size*start_y/h;
- uint8_t *end = buf + buf_size* end_y/h;
+ uint8_t *start= buf + (size_t)(((int64_t) buf_size)*start_y/h);
+ uint8_t *end = buf + (size_t)(((int64_t) buf_size)* end_y/h);
init_put_bits(&s->thread_context[i]->pb, start, end - start);
}
}
/**
- * motion compesation of a single macroblock
+ * motion compensation of a single macroblock
* @param s context
* @param dest_y luma destination pointer
* @param dest_cb chroma cb/u destination pointer
}
/**
- * motion compesation of a single macroblock
+ * motion compensation of a single macroblock
* @param s context
* @param dest_y luma destination pointer
* @param dest_cb chroma cb/u destination pointer
}
/* skip dequant / idct if we are really late ;) */
- if(s->hurry_up>1) return;
+ if(s->hurry_up>1) goto skip_idct;
+ if(s->avctx->skip_idct){
+ if( (s->avctx->skip_idct >= AVDISCARD_NONREF && s->pict_type == B_TYPE)
+ ||(s->avctx->skip_idct >= AVDISCARD_NONKEY && s->pict_type != I_TYPE)
+ || s->avctx->skip_idct >= AVDISCARD_ALL)
+ goto skip_idct;
+ }
/* add dct residue */
if(s->encoding || !( s->h263_msmpeg4 || s->codec_id==CODEC_ID_MPEG1VIDEO || s->codec_id==CODEC_ID_MPEG2VIDEO
}//gray
}
}
+skip_idct:
if(!readable){
s->dsp.put_pixels_tab[0][0](s->dest[0], dest_y , linesize,16);
s->dsp.put_pixels_tab[s->chroma_x_shift][0](s->dest[1], dest_cb, uvlinesize,16 >> s->chroma_y_shift);
}
void ff_init_block_index(MpegEncContext *s){ //FIXME maybe rename
- const int linesize= s->current_picture.linesize[0]; //not s->linesize as this woulnd be wrong for field pics
+ const int linesize= s->current_picture.linesize[0]; //not s->linesize as this would be wrong for field pics
const int uvlinesize= s->current_picture.linesize[1];
const int mb_size= 4 - s->avctx->lowres;