comparison mpegvideo.c @ 1945:32f68745c431 libavcodec

passing AVFrame instead of AVPicture around in ffmpeg, that way stuff like motion vectors can be passed from the decoder to the encoder moving ref_index from Picture to AVFrame
author michael
date Sat, 17 Apr 2004 19:41:49 +0000
parents a3f44c9168aa
children b306574523ad
comparison
equal deleted inserted replaced
1944:a3f44c9168aa 1945:32f68745c431
285 // dst->reference = src->reference; 285 // dst->reference = src->reference;
286 dst->pts = src->pts; 286 dst->pts = src->pts;
287 dst->interlaced_frame = src->interlaced_frame; 287 dst->interlaced_frame = src->interlaced_frame;
288 dst->top_field_first = src->top_field_first; 288 dst->top_field_first = src->top_field_first;
289 289
290 if(src->motion_val[0] && src->motion_val[0] != dst->motion_val[0]){ 290 if(s->avctx->me_threshold){
291 if(!src->motion_val[0])
292 av_log(s->avctx, AV_LOG_ERROR, "AVFrame.motion_val not set!\n");
293 if(!src->mb_type)
294 av_log(s->avctx, AV_LOG_ERROR, "AVFrame.mb_type not set!\n");
295 if(!src->ref_index[0])
296 av_log(s->avctx, AV_LOG_ERROR, "AVFrame.ref_index not set!\n");
291 if(src->motion_subsample_log2 != dst->motion_subsample_log2) 297 if(src->motion_subsample_log2 != dst->motion_subsample_log2)
292 av_log(s->avctx, AV_LOG_ERROR, "AVFrame.motion_subsample_log2 doesnt match!\n"); 298 av_log(s->avctx, AV_LOG_ERROR, "AVFrame.motion_subsample_log2 doesnt match!\n");
293 else{ 299
300 memcpy(dst->mb_type, src->mb_type, s->mb_stride * s->mb_height * sizeof(dst->mb_type[0]));
301
302 for(i=0; i<2; i++){
294 int stride= ((16*s->mb_width )>>src->motion_subsample_log2) + 1; 303 int stride= ((16*s->mb_width )>>src->motion_subsample_log2) + 1;
295 int height= ((16*s->mb_height)>>src->motion_subsample_log2); 304 int height= ((16*s->mb_height)>>src->motion_subsample_log2);
296 305
297 for(i=0; i<2; i++) 306 if(src->motion_val[i] && src->motion_val[i] != dst->motion_val[i]){
298 memcpy(dst->motion_val[i], src->motion_val[i], stride*height*sizeof(int16_t)); 307 memcpy(dst->motion_val[i], src->motion_val[i], 2*stride*height*sizeof(int16_t));
308 }
309 if(src->ref_index[i] && src->ref_index[i] != dst->ref_index[i]){
310 memcpy(dst->ref_index[i], src->ref_index[i], s->mb_stride*s->mb_height*sizeof(int8_t)); //FIXME init this too
311 }
299 } 312 }
300 } 313 }
301 } 314 }
302 315
303 /** 316 /**
361 pic->motion_subsample_log2= 2; 374 pic->motion_subsample_log2= 2;
362 }else if(s->out_format == FMT_H263 || s->encoding || (s->avctx->debug&FF_DEBUG_MV) || (s->avctx->debug_mv)){ 375 }else if(s->out_format == FMT_H263 || s->encoding || (s->avctx->debug&FF_DEBUG_MV) || (s->avctx->debug_mv)){
363 for(i=0; i<2; i++){ 376 for(i=0; i<2; i++){
364 CHECKED_ALLOCZ(pic->motion_val_base[i], 2 * (b8_array_size+2) * sizeof(int16_t)) 377 CHECKED_ALLOCZ(pic->motion_val_base[i], 2 * (b8_array_size+2) * sizeof(int16_t))
365 pic->motion_val[i]= pic->motion_val_base[i]+2; 378 pic->motion_val[i]= pic->motion_val_base[i]+2;
379 CHECKED_ALLOCZ(pic->ref_index[i], mb_array_size * sizeof(int8_t))
366 } 380 }
367 pic->motion_subsample_log2= 3; 381 pic->motion_subsample_log2= 3;
368 } 382 }
369 if(s->avctx->debug&FF_DEBUG_DCT_COEFF) { 383 if(s->avctx->debug&FF_DEBUG_DCT_COEFF) {
370 CHECKED_ALLOCZ(pic->dct_coeff, 64 * mb_array_size * sizeof(DCTELEM)*6) 384 CHECKED_ALLOCZ(pic->dct_coeff, 64 * mb_array_size * sizeof(DCTELEM)*6)