comparison mpegvideo.c @ 1827:fcbf31baa1af libavcodec

multithreaded mpeg2 decoding
author michael
date Mon, 23 Feb 2004 20:56:56 +0000
parents 98dbb5c7f8cc
children 7ae26b6e197f
comparison
equal deleted inserted replaced
1826:5fb6572ca817 1827:fcbf31baa1af
466 COPY(dct_count[0]); 466 COPY(dct_count[0]);
467 COPY(dct_count[1]); 467 COPY(dct_count[1]);
468 #undef COPY 468 #undef COPY
469 } 469 }
470 470
471 static void update_duplicate_context(MpegEncContext *dst, MpegEncContext *src){ 471 void ff_update_duplicate_context(MpegEncContext *dst, MpegEncContext *src){
472 MpegEncContext bak; 472 MpegEncContext bak;
473 int i;
473 //FIXME copy only needed parts 474 //FIXME copy only needed parts
474 //START_TIMER 475 //START_TIMER
475 backup_duplicate_context(&bak, dst); 476 backup_duplicate_context(&bak, dst);
476 memcpy(dst, src, sizeof(MpegEncContext)); 477 memcpy(dst, src, sizeof(MpegEncContext));
477 backup_duplicate_context(dst, &bak); 478 backup_duplicate_context(dst, &bak);
479 for(i=0;i<12;i++){
480 dst->pblocks[i] = (short *)(&dst->block[i]);
481 }
478 //STOP_TIMER("update_duplicate_context") //about 10k cycles / 0.01 sec for 1000frames on 1ghz with 2 threads 482 //STOP_TIMER("update_duplicate_context") //about 10k cycles / 0.01 sec for 1000frames on 1ghz with 2 threads
479 } 483 }
480 484
481 static void update_duplicate_context_after_me(MpegEncContext *dst, MpegEncContext *src){ 485 static void update_duplicate_context_after_me(MpegEncContext *dst, MpegEncContext *src){
482 #define COPY(a) dst->a= src->a 486 #define COPY(a) dst->a= src->a
4630 s->no_rounding ^= 1; 4634 s->no_rounding ^= 1;
4631 } 4635 }
4632 4636
4633 s->mb_intra=0; //for the rate distoration & bit compare functions 4637 s->mb_intra=0; //for the rate distoration & bit compare functions
4634 for(i=1; i<s->avctx->thread_count; i++){ 4638 for(i=1; i<s->avctx->thread_count; i++){
4635 update_duplicate_context(s->thread_context[i], s); 4639 ff_update_duplicate_context(s->thread_context[i], s);
4636 } 4640 }
4637 4641
4638 /* Estimate motion for every MB */ 4642 /* Estimate motion for every MB */
4639 if(s->pict_type != I_TYPE){ 4643 if(s->pict_type != I_TYPE){
4640 if(s->pict_type != B_TYPE){ 4644 if(s->pict_type != B_TYPE){