comparison snow.c @ 2197:ffa4fa6bebe9 libavcodec

10l more benchmarking code inline
author michael
date Sat, 28 Aug 2004 14:08:50 +0000
parents df3079d7806f
children 970c2de19b2e
comparison
equal deleted inserted replaced
2196:3eae46c131a3 2197:ffa4fa6bebe9
1904 int x,y; 1904 int x,y;
1905 const int qlog= clip(s->qlog + b->qlog, 0, 128); 1905 const int qlog= clip(s->qlog + b->qlog, 0, 128);
1906 int qmul= qexp[qlog&7]<<(qlog>>3); 1906 int qmul= qexp[qlog&7]<<(qlog>>3);
1907 int qadd= (s->qbias*qmul)>>QBIAS_SHIFT; 1907 int qadd= (s->qbias*qmul)>>QBIAS_SHIFT;
1908 1908
1909 START_TIMER
1910
1909 if(b->buf == s->spatial_dwt_buffer || s->qlog == LOSSLESS_QLOG){ 1911 if(b->buf == s->spatial_dwt_buffer || s->qlog == LOSSLESS_QLOG){
1910 qadd= 0; 1912 qadd= 0;
1911 qmul= 1<<QEXPSHIFT; 1913 qmul= 1<<QEXPSHIFT;
1912 } 1914 }
1913
1914 START_TIMER
1915 1915
1916 if(1){ 1916 if(1){
1917 int run; 1917 int run;
1918 int index=0; 1918 int index=0;
1919 int prev_index=-1; 1919 int prev_index=-1;
2505 mca( 0, 0,16) 2505 mca( 0, 0,16)
2506 mca( 8, 0,16) 2506 mca( 8, 0,16)
2507 mca( 0, 8,16) 2507 mca( 0, 8,16)
2508 mca( 8, 8,16) 2508 mca( 8, 8,16)
2509 2509
2510 static void add_xblock(SnowContext *s, DWTELEM *dst, uint8_t *src, uint8_t *obmc, int s_x, int s_y, int b_w, int b_h, int mv_x, int mv_y, int w, int h, int dst_stride, int src_stride, int obmc_stride, int mb_type, int add, int color){ 2510 static always_inline void add_xblock(SnowContext *s, DWTELEM *dst, uint8_t *src, uint8_t *obmc, int s_x, int s_y, int b_w, int b_h, int mv_x, int mv_y, int w, int h, int dst_stride, int src_stride, int obmc_stride, int mb_type, int add, int color){
2511 uint8_t tmp[src_stride*(b_h+5)]; //FIXME move to context to gurantee alignment 2511 uint8_t tmp[src_stride*(b_h+5)]; //FIXME move to context to gurantee alignment
2512 int x,y; 2512 int x,y;
2513 2513
2514 if(s_x<0){ 2514 if(s_x<0){
2515 obmc -= s_x; 2515 obmc -= s_x;
2577 int obmc_stride= plane_index ? block_size : 2*block_size; 2577 int obmc_stride= plane_index ? block_size : 2*block_size;
2578 int ref_stride= s->last_picture.linesize[plane_index]; 2578 int ref_stride= s->last_picture.linesize[plane_index];
2579 uint8_t *ref = s->last_picture.data[plane_index]; 2579 uint8_t *ref = s->last_picture.data[plane_index];
2580 int w= p->width; 2580 int w= p->width;
2581 int h= p->height; 2581 int h= p->height;
2582 START_TIMER
2582 2583
2583 if(s->avctx->debug&512){ 2584 if(s->avctx->debug&512){
2584 for(y=0; y<h; y++){ 2585 for(y=0; y<h; y++){
2585 for(x=0; x<w; x++){ 2586 for(x=0; x<w; x++){
2586 if(add) buf[x + y*w]+= 128*256; 2587 if(add) buf[x + y*w]+= 128*256;
2592 } 2593 }
2593 for(mb_y=-1; mb_y<=mb_h; mb_y++){ 2594 for(mb_y=-1; mb_y<=mb_h; mb_y++){
2594 for(mb_x=-1; mb_x<=mb_w; mb_x++){ 2595 for(mb_x=-1; mb_x<=mb_w; mb_x++){
2595 int index= clip(mb_x, 0, mb_w-1) + clip(mb_y, 0, mb_h-1)*mb_stride; 2596 int index= clip(mb_x, 0, mb_w-1) + clip(mb_y, 0, mb_h-1)*mb_stride;
2596 2597
2598 START_TIMER
2597 add_xblock(s, buf, ref, obmc, 2599 add_xblock(s, buf, ref, obmc,
2598 block_w*mb_x - block_w/2, 2600 block_w*mb_x - block_w/2,
2599 block_w*mb_y - block_w/2, 2601 block_w*mb_y - block_w/2,
2600 2*block_w, 2*block_w, 2602 2*block_w, 2*block_w,
2601 s->block[index].mx*scale, s->block[index].my*scale, 2603 s->block[index].mx*scale, s->block[index].my*scale,
2602 w, h, 2604 w, h,
2603 w, ref_stride, obmc_stride, 2605 w, ref_stride, obmc_stride,
2604 s->block[index].type, add, s->block[index].color[plane_index]); 2606 s->block[index].type, add, s->block[index].color[plane_index]);
2605 2607
2606 } 2608 STOP_TIMER("add_xblock")
2607 } 2609 }
2610 }
2611
2612 STOP_TIMER("predict_plane")
2608 } 2613 }
2609 2614
2610 static void quantize(SnowContext *s, SubBand *b, DWTELEM *src, int stride, int bias){ 2615 static void quantize(SnowContext *s, SubBand *b, DWTELEM *src, int stride, int bias){
2611 const int level= b->level; 2616 const int level= b->level;
2612 const int w= b->width; 2617 const int w= b->width;