comparison mpegvideo.c @ 814:8f31ed5bacd1 libavcodec

dont call emms_c() for each MB
author michaelni
date Thu, 31 Oct 2002 12:11:53 +0000
parents dfaa1c45bd27
children 78accc54493b
comparison
equal deleted inserted replaced
813:dfaa1c45bd27 814:8f31ed5bacd1
1817 if(*mbskip_ptr >99) *mbskip_ptr= 99; 1817 if(*mbskip_ptr >99) *mbskip_ptr= 99;
1818 1818
1819 /* if previous was skipped too, then nothing to do ! 1819 /* if previous was skipped too, then nothing to do !
1820 skip only during decoding as we might trash the buffers during encoding a bit */ 1820 skip only during decoding as we might trash the buffers during encoding a bit */
1821 if (*mbskip_ptr >= s->ip_buffer_count && !s->encoding) 1821 if (*mbskip_ptr >= s->ip_buffer_count && !s->encoding)
1822 goto the_end; 1822 return;
1823 } else { 1823 } else {
1824 *mbskip_ptr = 0; /* not skipped */ 1824 *mbskip_ptr = 0; /* not skipped */
1825 } 1825 }
1826 } 1826 }
1827 1827
1864 MPV_motion(s, dest_y, dest_cb, dest_cr, 1, s->next_picture, op_pix, op_qpix); 1864 MPV_motion(s, dest_y, dest_cb, dest_cr, 1, s->next_picture, op_pix, op_qpix);
1865 } 1865 }
1866 } 1866 }
1867 1867
1868 /* skip dequant / idct if we are really late ;) */ 1868 /* skip dequant / idct if we are really late ;) */
1869 if(s->hurry_up>1) goto the_end; 1869 if(s->hurry_up>1) return;
1870 1870
1871 /* add dct residue */ 1871 /* add dct residue */
1872 if(s->encoding || !( s->mpeg2 || s->h263_msmpeg4 || s->codec_id==CODEC_ID_MPEG1VIDEO 1872 if(s->encoding || !( s->mpeg2 || s->h263_msmpeg4 || s->codec_id==CODEC_ID_MPEG1VIDEO
1873 || (s->codec_id==CODEC_ID_MPEG4 && !s->mpeg_quant))){ 1873 || (s->codec_id==CODEC_ID_MPEG4 && !s->mpeg_quant))){
1874 add_dequant_dct(s, block[0], 0, dest_y, dct_linesize); 1874 add_dequant_dct(s, block[0], 0, dest_y, dct_linesize);
1914 s->idct_put(dest_cr, s->uvlinesize, block[5]); 1914 s->idct_put(dest_cr, s->uvlinesize, block[5]);
1915 } 1915 }
1916 } 1916 }
1917 } 1917 }
1918 } 1918 }
1919 the_end:
1920 emms_c(); //FIXME remove
1921 } 1919 }
1922 1920
1923 static inline void dct_single_coeff_elimination(MpegEncContext *s, int n, int threshold) 1921 static inline void dct_single_coeff_elimination(MpegEncContext *s, int n, int threshold)
1924 { 1922 {
1925 static const char tab[64]= 1923 static const char tab[64]=
2572 else 2570 else
2573 ff_estimate_p_frame_motion(s, mb_x, mb_y); 2571 ff_estimate_p_frame_motion(s, mb_x, mb_y);
2574 // s->mb_type[mb_y*s->mb_width + mb_x]=MB_TYPE_INTER; 2572 // s->mb_type[mb_y*s->mb_width + mb_x]=MB_TYPE_INTER;
2575 } 2573 }
2576 } 2574 }
2577 emms_c();
2578 }else /* if(s->pict_type == I_TYPE) */{ 2575 }else /* if(s->pict_type == I_TYPE) */{
2579 /* I-Frame */ 2576 /* I-Frame */
2580 //FIXME do we need to zero them? 2577 //FIXME do we need to zero them?
2581 memset(s->motion_val[0], 0, sizeof(INT16)*(s->mb_width*2 + 2)*(s->mb_height*2 + 2)*2); 2578 memset(s->motion_val[0], 0, sizeof(INT16)*(s->mb_width*2 + 2)*(s->mb_height*2 + 2)*2);
2582 memset(s->p_mv_table , 0, sizeof(INT16)*(s->mb_width+2)*(s->mb_height+2)*2); 2579 memset(s->p_mv_table , 0, sizeof(INT16)*(s->mb_width+2)*(s->mb_height+2)*2);
2599 s->mb_var_sum += varc; 2596 s->mb_var_sum += varc;
2600 } 2597 }
2601 } 2598 }
2602 } 2599 }
2603 } 2600 }
2601 emms_c();
2602
2604 if(s->scene_change_score > 0 && s->pict_type == P_TYPE){ 2603 if(s->scene_change_score > 0 && s->pict_type == P_TYPE){
2605 s->pict_type= I_TYPE; 2604 s->pict_type= I_TYPE;
2606 memset(s->mb_type , MB_TYPE_INTRA, sizeof(UINT8)*s->mb_width*s->mb_height); 2605 memset(s->mb_type , MB_TYPE_INTRA, sizeof(UINT8)*s->mb_width*s->mb_height);
2607 if(s->max_b_frames==0){ 2606 if(s->max_b_frames==0){
2608 s->input_pict_type= I_TYPE; 2607 s->input_pict_type= I_TYPE;