comparison libmpcodecs/vd_ffmpeg.c @ 28509:905a8897c910

Remove trailing whitespace from vd_ffmpeg.
author reimar
date Thu, 12 Feb 2009 15:41:59 +0000
parents c475b032694f
children afcd1ee3d3f1
comparison
equal deleted inserted replaced
28508:c475b032694f 28509:905a8897c910
222 222
223 ctx = sh->context = malloc(sizeof(vd_ffmpeg_ctx)); 223 ctx = sh->context = malloc(sizeof(vd_ffmpeg_ctx));
224 if (!ctx) 224 if (!ctx)
225 return 0; 225 return 0;
226 memset(ctx, 0, sizeof(vd_ffmpeg_ctx)); 226 memset(ctx, 0, sizeof(vd_ffmpeg_ctx));
227 227
228 lavc_codec = (AVCodec *)avcodec_find_decoder_by_name(sh->codec->dll); 228 lavc_codec = (AVCodec *)avcodec_find_decoder_by_name(sh->codec->dll);
229 if(!lavc_codec){ 229 if(!lavc_codec){
230 mp_msg(MSGT_DECVIDEO,MSGL_ERR,MSGTR_MissingLAVCcodec,sh->codec->dll); 230 mp_msg(MSGT_DECVIDEO,MSGL_ERR,MSGTR_MissingLAVCcodec,sh->codec->dll);
231 uninit(sh); 231 uninit(sh);
232 return 0; 232 return 0;
233 } 233 }
234 234
235 if(vd_use_slices && (lavc_codec->capabilities&CODEC_CAP_DRAW_HORIZ_BAND) && !do_vis_debug) 235 if(vd_use_slices && (lavc_codec->capabilities&CODEC_CAP_DRAW_HORIZ_BAND) && !do_vis_debug)
236 ctx->do_slices=1; 236 ctx->do_slices=1;
237 237
238 if(lavc_codec->capabilities&CODEC_CAP_DR1 && !do_vis_debug && lavc_codec->id != CODEC_ID_H264 && lavc_codec->id != CODEC_ID_INTERPLAY_VIDEO && lavc_codec->id != CODEC_ID_ROQ) 238 if(lavc_codec->capabilities&CODEC_CAP_DR1 && !do_vis_debug && lavc_codec->id != CODEC_ID_H264 && lavc_codec->id != CODEC_ID_INTERPLAY_VIDEO && lavc_codec->id != CODEC_ID_ROQ)
239 ctx->do_dr1=1; 239 ctx->do_dr1=1;
240 ctx->b_age= ctx->ip_age[0]= ctx->ip_age[1]= 256*256*256*64; 240 ctx->b_age= ctx->ip_age[0]= ctx->ip_age[1]= 256*256*256*64;
241 ctx->ip_count= ctx->b_count= 0; 241 ctx->ip_count= ctx->b_count= 0;
242 242
257 avctx->draw_horiz_band = mc_render_slice; 257 avctx->draw_horiz_band = mc_render_slice;
258 avctx->slice_flags=SLICE_FLAG_CODED_ORDER|SLICE_FLAG_ALLOW_FIELD; 258 avctx->slice_flags=SLICE_FLAG_CODED_ORDER|SLICE_FLAG_ALLOW_FIELD;
259 }else 259 }else
260 #endif /* CONFIG_XVMC */ 260 #endif /* CONFIG_XVMC */
261 if(ctx->do_dr1){ 261 if(ctx->do_dr1){
262 avctx->flags|= CODEC_FLAG_EMU_EDGE; 262 avctx->flags|= CODEC_FLAG_EMU_EDGE;
263 avctx->get_buffer= get_buffer; 263 avctx->get_buffer= get_buffer;
264 avctx->release_buffer= release_buffer; 264 avctx->release_buffer= release_buffer;
265 avctx->reget_buffer= get_buffer; 265 avctx->reget_buffer= get_buffer;
266 } 266 }
267 267
268 avctx->flags|= CODEC_FLAG_NOT_TRUNCATED; 268 avctx->flags|= CODEC_FLAG_NOT_TRUNCATED;
269 avctx->flags|= lavc_param_bitexact; 269 avctx->flags|= lavc_param_bitexact;
270 270
271 avctx->width = sh->disp_w; 271 avctx->width = sh->disp_w;
272 avctx->height= sh->disp_h; 272 avctx->height= sh->disp_h;
273 avctx->workaround_bugs= lavc_param_workaround_bugs; 273 avctx->workaround_bugs= lavc_param_workaround_bugs;
274 avctx->error_recognition= lavc_param_error_resilience; 274 avctx->error_recognition= lavc_param_error_resilience;
275 if(lavc_param_gray) avctx->flags|= CODEC_FLAG_GRAY; 275 if(lavc_param_gray) avctx->flags|= CODEC_FLAG_GRAY;
331 331
332 #if 0 332 #if 0
333 { 333 {
334 int x; 334 int x;
335 uint8_t *p = avctx->extradata; 335 uint8_t *p = avctx->extradata;
336 336
337 for (x=0; x<avctx->extradata_size; x++) 337 for (x=0; x<avctx->extradata_size; x++)
338 mp_msg(MSGT_DECVIDEO, MSGL_INFO,"[%x] ", p[x]); 338 mp_msg(MSGT_DECVIDEO, MSGL_INFO,"[%x] ", p[x]);
339 mp_msg(MSGT_DECVIDEO, MSGL_INFO,"\n"); 339 mp_msg(MSGT_DECVIDEO, MSGL_INFO,"\n");
340 } 340 }
341 #endif 341 #endif
403 403
404 // uninit driver 404 // uninit driver
405 static void uninit(sh_video_t *sh){ 405 static void uninit(sh_video_t *sh){
406 vd_ffmpeg_ctx *ctx = sh->context; 406 vd_ffmpeg_ctx *ctx = sh->context;
407 AVCodecContext *avctx = ctx->avctx; 407 AVCodecContext *avctx = ctx->avctx;
408 408
409 if(lavc_param_vstats){ 409 if(lavc_param_vstats){
410 int i; 410 int i;
411 for(i=1; i<32; i++){ 411 for(i=1; i<32; i++){
412 mp_msg(MSGT_DECVIDEO, MSGL_INFO,"QP: %d, count: %d\n", i, ctx->qp_stat[i]); 412 mp_msg(MSGT_DECVIDEO, MSGL_INFO,"QP: %d, count: %d\n", i, ctx->qp_stat[i]);
413 } 413 }
414 mp_msg(MSGT_DECVIDEO, MSGL_INFO,MSGTR_MPCODECS_ArithmeticMeanOfQP, 414 mp_msg(MSGT_DECVIDEO, MSGL_INFO,MSGTR_MPCODECS_ArithmeticMeanOfQP,
415 ctx->qp_sum / avctx->coded_frame->coded_picture_number, 415 ctx->qp_sum / avctx->coded_frame->coded_picture_number,
416 1.0/(ctx->inv_qp_sum / avctx->coded_frame->coded_picture_number) 416 1.0/(ctx->inv_qp_sum / avctx->coded_frame->coded_picture_number)
417 ); 417 );
418 } 418 }
419 419
442 int width= s->width; 442 int width= s->width;
443 int skip_stride= ((width<<lavc_param_lowres)+15)>>4; 443 int skip_stride= ((width<<lavc_param_lowres)+15)>>4;
444 uint8_t *skip= &s->coded_frame->mbskip_table[(y>>4)*skip_stride]; 444 uint8_t *skip= &s->coded_frame->mbskip_table[(y>>4)*skip_stride];
445 int threshold= s->coded_frame->age; 445 int threshold= s->coded_frame->age;
446 if(s->pict_type!=B_TYPE){ 446 if(s->pict_type!=B_TYPE){
447 for(i=0; i*16<width+16; i++){ 447 for(i=0; i*16<width+16; i++){
448 if(i*16>=width || skip[i]>=threshold){ 448 if(i*16>=width || skip[i]>=threshold){
449 if(start==i) start++; 449 if(start==i) start++;
450 else{ 450 else{
451 uint8_t *src2[3]= {src[0] + start*16, 451 uint8_t *src2[3]= {src[0] + start*16,
452 src[1] + start*8, 452 src[1] + start*8,
453 src[2] + start*8}; 453 src[2] + start*8};
454 //printf("%2d-%2d x %d\n", start, i, y); 454 //printf("%2d-%2d x %d\n", start, i, y);
455 mpcodecs_draw_slice (sh,src2, stride, (i-start)*16, height, start*16, y); 455 mpcodecs_draw_slice (sh,src2, stride, (i-start)*16, height, start*16, y);
456 start= i+1; 456 start= i+1;
457 } 457 }
458 } 458 }
459 } 459 }
460 }else 460 }else
461 #endif 461 #endif
462 if (y < sh->disp_h) { 462 if (y < sh->disp_h) {
463 mpcodecs_draw_slice (sh, source, src->linesize, sh->disp_w, (y+height)<=sh->disp_h?height:sh->disp_h-y, 0, y); 463 mpcodecs_draw_slice (sh, source, src->linesize, sh->disp_w, (y+height)<=sh->disp_h?height:sh->disp_h-y, 0, y);
479 // use dimensions from BIH to avoid black borders at the right and bottom. 479 // use dimensions from BIH to avoid black borders at the right and bottom.
480 if (sh->bih && sh->ImageDesc) { 480 if (sh->bih && sh->ImageDesc) {
481 width = sh->bih->biWidth>>lavc_param_lowres; 481 width = sh->bih->biWidth>>lavc_param_lowres;
482 height = sh->bih->biHeight>>lavc_param_lowres; 482 height = sh->bih->biHeight>>lavc_param_lowres;
483 } 483 }
484 484
485 // it is possible another vo buffers to be used after vo config() 485 // it is possible another vo buffers to be used after vo config()
486 // lavc reset its buffers on width/heigh change but not on aspect change!!! 486 // lavc reset its buffers on width/heigh change but not on aspect change!!!
487 if (av_cmp_q(avctx->sample_aspect_ratio, ctx->last_sample_aspect_ratio) || 487 if (av_cmp_q(avctx->sample_aspect_ratio, ctx->last_sample_aspect_ratio) ||
488 width != sh->disp_w || 488 width != sh->disp_w ||
489 height != sh->disp_h || 489 height != sh->disp_h ||
490 pix_fmt != ctx->pix_fmt || 490 pix_fmt != ctx->pix_fmt ||
491 !ctx->vo_initialized) 491 !ctx->vo_initialized)
492 { 492 {
493 mp_msg(MSGT_DECVIDEO, MSGL_V, "[ffmpeg] aspect_ratio: %f\n", aspect); 493 mp_msg(MSGT_DECVIDEO, MSGL_V, "[ffmpeg] aspect_ratio: %f\n", aspect);
494 if (sh->aspect == 0 || 494 if (sh->aspect == 0 ||
495 av_cmp_q(avctx->sample_aspect_ratio, 495 av_cmp_q(avctx->sample_aspect_ratio,
496 ctx->last_sample_aspect_ratio)) 496 ctx->last_sample_aspect_ratio))
497 sh->aspect = aspect; 497 sh->aspect = aspect;
498 ctx->last_sample_aspect_ratio = avctx->sample_aspect_ratio; 498 ctx->last_sample_aspect_ratio = avctx->sample_aspect_ratio;
499 sh->disp_w = width; 499 sh->disp_w = width;
500 sh->disp_h = height; 500 sh->disp_h = height;
614 614
615 pic->data[0]= mpi->planes[0]; 615 pic->data[0]= mpi->planes[0];
616 pic->data[1]= mpi->planes[1]; 616 pic->data[1]= mpi->planes[1];
617 pic->data[2]= mpi->planes[2]; 617 pic->data[2]= mpi->planes[2];
618 618
619 #if 0 619 #if 0
620 assert(mpi->width >= ((width +align)&(~align))); 620 assert(mpi->width >= ((width +align)&(~align)));
621 assert(mpi->height >= ((height+align)&(~align))); 621 assert(mpi->height >= ((height+align)&(~align)));
622 assert(mpi->stride[0] >= mpi->width); 622 assert(mpi->stride[0] >= mpi->width);
623 if(mpi->imgfmt==IMGFMT_I420 || mpi->imgfmt==IMGFMT_YV12 || mpi->imgfmt==IMGFMT_IYUV){ 623 if(mpi->imgfmt==IMGFMT_I420 || mpi->imgfmt==IMGFMT_YV12 || mpi->imgfmt==IMGFMT_IYUV){
624 const int y_size= mpi->stride[0] * (mpi->h-1) + mpi->w; 624 const int y_size= mpi->stride[0] * (mpi->h-1) + mpi->w;
625 const int c_size= mpi->stride[1] * ((mpi->h>>1)-1) + (mpi->w>>1); 625 const int c_size= mpi->stride[1] * ((mpi->h>>1)-1) + (mpi->w>>1);
626 626
627 assert(mpi->planes[0] > mpi->planes[1] || mpi->planes[0] + y_size <= mpi->planes[1]); 627 assert(mpi->planes[0] > mpi->planes[1] || mpi->planes[0] + y_size <= mpi->planes[1]);
628 assert(mpi->planes[0] > mpi->planes[2] || mpi->planes[0] + y_size <= mpi->planes[2]); 628 assert(mpi->planes[0] > mpi->planes[2] || mpi->planes[0] + y_size <= mpi->planes[2]);
629 assert(mpi->planes[1] > mpi->planes[0] || mpi->planes[1] + c_size <= mpi->planes[0]); 629 assert(mpi->planes[1] > mpi->planes[0] || mpi->planes[1] + c_size <= mpi->planes[0]);
630 assert(mpi->planes[1] > mpi->planes[2] || mpi->planes[1] + c_size <= mpi->planes[2]); 630 assert(mpi->planes[1] > mpi->planes[2] || mpi->planes[1] + c_size <= mpi->planes[2]);
631 assert(mpi->planes[2] > mpi->planes[0] || mpi->planes[2] + c_size <= mpi->planes[0]); 631 assert(mpi->planes[2] > mpi->planes[0] || mpi->planes[2] + c_size <= mpi->planes[0]);
650 else 650 else
651 printf("."); 651 printf(".");
652 #endif 652 #endif
653 if(pic->reference){ 653 if(pic->reference){
654 pic->age= ctx->ip_age[0]; 654 pic->age= ctx->ip_age[0];
655 655
656 ctx->ip_age[0]= ctx->ip_age[1]+1; 656 ctx->ip_age[0]= ctx->ip_age[1]+1;
657 ctx->ip_age[1]= 1; 657 ctx->ip_age[1]= 1;
658 ctx->b_age++; 658 ctx->b_age++;
659 }else{ 659 }else{
660 pic->age= ctx->b_age; 660 pic->age= ctx->b_age;
661 661
662 ctx->ip_age[0]++; 662 ctx->ip_age[0]++;
663 ctx->ip_age[1]++; 663 ctx->ip_age[1]++;
664 ctx->b_age=1; 664 ctx->b_age=1;
665 } 665 }
666 pic->type= FF_BUFFER_TYPE_USER; 666 pic->type= FF_BUFFER_TYPE_USER;
671 mp_image_t* mpi= pic->opaque; 671 mp_image_t* mpi= pic->opaque;
672 sh_video_t * sh = avctx->opaque; 672 sh_video_t * sh = avctx->opaque;
673 vd_ffmpeg_ctx *ctx = sh->context; 673 vd_ffmpeg_ctx *ctx = sh->context;
674 int i; 674 int i;
675 675
676 //printf("release buffer %d %d %d\n", mpi ? mpi->flags&MP_IMGFLAG_PRESERVE : -99, ctx->ip_count, ctx->b_count); 676 //printf("release buffer %d %d %d\n", mpi ? mpi->flags&MP_IMGFLAG_PRESERVE : -99, ctx->ip_count, ctx->b_count);
677 677
678 if(ctx->ip_count <= 2 && ctx->b_count<=1){ 678 if(ctx->ip_count <= 2 && ctx->b_count<=1){
679 if(mpi->flags&MP_IMGFLAG_PRESERVE) 679 if(mpi->flags&MP_IMGFLAG_PRESERVE)
680 ctx->ip_count--; 680 ctx->ip_count--;
681 else 681 else
811 break; 811 break;
812 default: 812 default:
813 fprintf(fvstats, "type= ? (%d)\n", pic->pict_type); 813 fprintf(fvstats, "type= ? (%d)\n", pic->pict_type);
814 break; 814 break;
815 } 815 }
816 816
817 ctx->qp_stat[(int)(quality+0.5)]++; 817 ctx->qp_stat[(int)(quality+0.5)]++;
818 ctx->qp_sum += quality; 818 ctx->qp_sum += quality;
819 ctx->inv_qp_sum += 1.0/(double)quality; 819 ctx->inv_qp_sum += 1.0/(double)quality;
820 820
821 break; 821 break;
822 } 822 }
823 //-- 823 //--
824 824
825 if(!got_picture) return NULL; // skipped image 825 if(!got_picture) return NULL; // skipped image
827 if(init_vo(sh,avctx->pix_fmt) < 0) return NULL; 827 if(init_vo(sh,avctx->pix_fmt) < 0) return NULL;
828 828
829 if(dr1 && pic->opaque){ 829 if(dr1 && pic->opaque){
830 mpi= (mp_image_t*)pic->opaque; 830 mpi= (mp_image_t*)pic->opaque;
831 } 831 }
832 832
833 if(!mpi) 833 if(!mpi)
834 mpi=mpcodecs_get_image(sh, MP_IMGTYPE_EXPORT, MP_IMGFLAG_PRESERVE, 834 mpi=mpcodecs_get_image(sh, MP_IMGTYPE_EXPORT, MP_IMGFLAG_PRESERVE,
835 avctx->width, avctx->height); 835 avctx->width, avctx->height);
836 if(!mpi){ // temporary! 836 if(!mpi){ // temporary!
837 mp_msg(MSGT_DECVIDEO, MSGL_WARN, MSGTR_MPCODECS_CouldntAllocateImageForCodec); 837 mp_msg(MSGT_DECVIDEO, MSGL_WARN, MSGTR_MPCODECS_CouldntAllocateImageForCodec);
838 return NULL; 838 return NULL;
839 } 839 }
840 840
841 if(!dr1){ 841 if(!dr1){
842 mpi->planes[0]=pic->data[0]; 842 mpi->planes[0]=pic->data[0];
843 mpi->planes[1]=pic->data[1]; 843 mpi->planes[1]=pic->data[1];
844 mpi->planes[2]=pic->data[2]; 844 mpi->planes[2]=pic->data[2];
845 mpi->stride[0]=pic->linesize[0]; 845 mpi->stride[0]=pic->linesize[0];
846 mpi->stride[1]=pic->linesize[1]; 846 mpi->stride[1]=pic->linesize[1];
847 mpi->stride[2]=pic->linesize[2]; 847 mpi->stride[2]=pic->linesize[2];
848 } 848 }
849 849
850 if (!mpi->planes[0]) 850 if (!mpi->planes[0])
851 return NULL; 851 return NULL;
852 852
853 if(avctx->pix_fmt==PIX_FMT_YUV422P && mpi->chroma_y_shift==1){ 853 if(avctx->pix_fmt==PIX_FMT_YUV422P && mpi->chroma_y_shift==1){
854 // we have 422p but user wants 420p 854 // we have 422p but user wants 420p
855 mpi->stride[1]*=2; 855 mpi->stride[1]*=2;
856 mpi->stride[2]*=2; 856 mpi->stride[2]*=2;
857 } 857 }
858 858
859 #ifdef WORDS_BIGENDIAN 859 #ifdef WORDS_BIGENDIAN
860 // FIXME: this might cause problems for buffers with FF_BUFFER_HINTS_PRESERVE 860 // FIXME: this might cause problems for buffers with FF_BUFFER_HINTS_PRESERVE
861 if (mpi->bpp == 8) 861 if (mpi->bpp == 8)
862 swap_palette(mpi->planes[1]); 862 swap_palette(mpi->planes[1]);
863 #endif 863 #endif
866 mpi->qstride=pic->qstride; 866 mpi->qstride=pic->qstride;
867 mpi->pict_type=pic->pict_type; 867 mpi->pict_type=pic->pict_type;
868 mpi->qscale_type= pic->qscale_type; 868 mpi->qscale_type= pic->qscale_type;
869 mpi->fields = MP_IMGFIELD_ORDERED; 869 mpi->fields = MP_IMGFIELD_ORDERED;
870 if(pic->interlaced_frame) mpi->fields |= MP_IMGFIELD_INTERLACED; 870 if(pic->interlaced_frame) mpi->fields |= MP_IMGFIELD_INTERLACED;
871 if(pic->top_field_first ) mpi->fields |= MP_IMGFIELD_TOP_FIRST; 871 if(pic->top_field_first ) mpi->fields |= MP_IMGFIELD_TOP_FIRST;
872 if(pic->repeat_pict == 1) mpi->fields |= MP_IMGFIELD_REPEAT_FIRST; 872 if(pic->repeat_pict == 1) mpi->fields |= MP_IMGFIELD_REPEAT_FIRST;
873 873
874 return mpi; 874 return mpi;
875 } 875 }
876 876
877 #if CONFIG_XVMC 877 #if CONFIG_XVMC
878 static enum PixelFormat get_format(struct AVCodecContext * avctx, 878 static enum PixelFormat get_format(struct AVCodecContext * avctx,
879 const enum PixelFormat * fmt){ 879 const enum PixelFormat * fmt){
880 sh_video_t * sh = avctx->opaque; 880 sh_video_t * sh = avctx->opaque;
881 int i; 881 int i;
882 882
883 if(avctx->xvmc_acceleration){ 883 if(avctx->xvmc_acceleration){
902 static int mc_get_buffer(AVCodecContext *avctx, AVFrame *pic){ 902 static int mc_get_buffer(AVCodecContext *avctx, AVFrame *pic){
903 sh_video_t * sh = avctx->opaque; 903 sh_video_t * sh = avctx->opaque;
904 vd_ffmpeg_ctx *ctx = sh->context; 904 vd_ffmpeg_ctx *ctx = sh->context;
905 mp_image_t* mpi=NULL; 905 mp_image_t* mpi=NULL;
906 struct xvmc_render_state * render; 906 struct xvmc_render_state * render;
907 int flags= MP_IMGFLAG_ACCEPT_STRIDE | MP_IMGFLAG_PREFER_ALIGNED_STRIDE| 907 int flags= MP_IMGFLAG_ACCEPT_STRIDE | MP_IMGFLAG_PREFER_ALIGNED_STRIDE|
908 MP_IMGFLAG_DRAW_CALLBACK; 908 MP_IMGFLAG_DRAW_CALLBACK;
909 909
910 // printf("vd_ffmpeg::mc_get_buffer (xvmc) %d %d %d\n", pic->reference, ctx->ip_count, ctx->b_count); 910 // printf("vd_ffmpeg::mc_get_buffer (xvmc) %d %d %d\n", pic->reference, ctx->ip_count, ctx->b_count);
911 if(!avctx->xvmc_acceleration){ 911 if(!avctx->xvmc_acceleration){
912 mp_msg(MSGT_DECVIDEO, MSGL_INFO, MSGTR_MPCODECS_McGetBufferShouldWorkOnlyWithXVMC); 912 mp_msg(MSGT_DECVIDEO, MSGL_INFO, MSGTR_MPCODECS_McGetBufferShouldWorkOnlyWithXVMC);
913 assert(0); 913 assert(0);
914 exit(1); 914 exit(1);
940 mp_msg(MSGT_DECVIDEO, MSGL_ERR, MSGTR_MPCODECS_UnrecoverableErrorRenderBuffersNotTaken); 940 mp_msg(MSGT_DECVIDEO, MSGL_ERR, MSGTR_MPCODECS_UnrecoverableErrorRenderBuffersNotTaken);
941 assert(0); 941 assert(0);
942 exit(1); 942 exit(1);
943 // return -1;//!!fixme check error conditions in ffmpeg 943 // return -1;//!!fixme check error conditions in ffmpeg
944 }; 944 };
945 945
946 if( (mpi->flags & MP_IMGFLAG_DIRECT) == 0){ 946 if( (mpi->flags & MP_IMGFLAG_DIRECT) == 0){
947 mp_msg(MSGT_DECVIDEO, MSGL_ERR, MSGTR_MPCODECS_OnlyBuffersAllocatedByVoXvmcAllowed); 947 mp_msg(MSGT_DECVIDEO, MSGL_ERR, MSGTR_MPCODECS_OnlyBuffersAllocatedByVoXvmcAllowed);
948 assert(0); 948 assert(0);
949 exit(1); 949 exit(1);
950 // return -1;//!!fixme check error conditions in ffmpeg 950 // return -1;//!!fixme check error conditions in ffmpeg
951 } 951 }
952 952
953 pic->data[0]= mpi->planes[0]; 953 pic->data[0]= mpi->planes[0];
954 pic->data[1]= mpi->planes[1]; 954 pic->data[1]= mpi->planes[1];
955 pic->data[2]= mpi->planes[2]; 955 pic->data[2]= mpi->planes[2];
956 956
957 957
965 pic->opaque = mpi; 965 pic->opaque = mpi;
966 966
967 if(pic->reference){ 967 if(pic->reference){
968 //I or P frame 968 //I or P frame
969 pic->age= ctx->ip_age[0]; 969 pic->age= ctx->ip_age[0];
970 970
971 ctx->ip_age[0]= ctx->ip_age[1]+1; 971 ctx->ip_age[0]= ctx->ip_age[1]+1;
972 ctx->ip_age[1]= 1; 972 ctx->ip_age[1]= 1;
973 ctx->b_age++; 973 ctx->b_age++;
974 }else{ 974 }else{
975 //B frame 975 //B frame
976 pic->age= ctx->b_age; 976 pic->age= ctx->b_age;
977 977
978 ctx->ip_age[0]++; 978 ctx->ip_age[0]++;
979 ctx->ip_age[1]++; 979 ctx->ip_age[1]++;
980 ctx->b_age=1; 980 ctx->b_age=1;
981 } 981 }
982 982
1024 AVFrame *src, int offset[4], 1024 AVFrame *src, int offset[4],
1025 int y, int type, int height){ 1025 int y, int type, int height){
1026 int width= s->width; 1026 int width= s->width;
1027 sh_video_t * sh = s->opaque; 1027 sh_video_t * sh = s->opaque;
1028 uint8_t *source[3]= {src->data[0], src->data[1], src->data[2]}; 1028 uint8_t *source[3]= {src->data[0], src->data[1], src->data[2]};
1029 1029
1030 assert(src->linesize[0]==0 && src->linesize[1]==0 && src->linesize[2]==0); 1030 assert(src->linesize[0]==0 && src->linesize[1]==0 && src->linesize[2]==0);
1031 assert(offset[0]==0 && offset[1]==0 && offset[2]==0); 1031 assert(offset[0]==0 && offset[1]==0 && offset[2]==0);
1032 1032
1033 mpcodecs_draw_slice (sh, source, src->linesize, width, height, 0, y); 1033 mpcodecs_draw_slice (sh, source, src->linesize, width, height, 0, y);
1034 1034
1035 } 1035 }
1036 1036
1037 #endif /* CONFIG_XVMC */ 1037 #endif /* CONFIG_XVMC */