Mercurial > mplayer.hg
view liba52/test.c @ 4689:61f4b8fd380e
Fixing "quake" by direct waiting of vsync.
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
(I don't why - but SMART_SWITCH is always disabled on my card)
Benchmarks:
[SRC] VIDEO: [DIV3] 624x356 24bpp 24.00 fps 497.3 kbps (60.7 kbyte/s)
[DEST] 1024x768@32 70fps (-xvidix -fs -zoom)
-vc ffdivx -double:
BENCHMARKs: V: 3.838s VO: 7.305s A: 0.555s Sys: 18.264s = 29.962s
BENCHMARK%: V: 12.8110% VO: 24.3808% A: 1.8518% Sys: 60.9564% = 100.0000%
total video time: 11.143s
-vc ffdivx -nodouble:
BENCHMARKs: V: 3.846s VO: 1.668s A: 0.539s Sys: 23.869s = 29.922s
BENCHMARK%: V: 12.8525% VO: 5.5744% A: 1.8015% Sys: 79.7716% = 100.0000%
total video time: 5.514s
-vc divxds -double (direct rendering)
BENCHMARKs: V: 8.275s VO: 5.750s A: 0.532s Sys: 15.414s = 29.971s
BENCHMARK%: V: 27.6115% VO: 19.1850% A: 1.7737% Sys: 51.4298% = 100.0000%
total video time: 14.070s
-vc divxds -nodouble (direct rendering)
BENCHMARKs: V: 7.353s VO: 0.002s A: 0.521s Sys: 22.083s = 29.958s
BENCHMARK%: V: 24.5433% VO: 0.0052% A: 1.7382% Sys: 73.7133% = 100.0000%
total video time: 7.355s
Unfortunately we have dramatic lost of performance (100%) :(
author | nick |
---|---|
date | Wed, 13 Feb 2002 08:24:13 +0000 |
parents | 0cc94b1eec0f |
children | 4e7d8679d6d8 |
line wrap: on
line source
// liba52 sample by A'rpi/ESP-team // reads ac3 stream form stdin, decodes and downmix to s16 stereo pcm and // writes it to stdout. resulting stream playbackable with sox: // play -c 2 -r 48000 out.sw //#define TIMING //needs Pentium or newer #include <stdio.h> #include <stdlib.h> #include <inttypes.h> #include "a52.h" #include "mm_accel.h" #include "../cpudetect.h" static sample_t * samples; static a52_state_t state; static uint8_t buf[3840]; static int buf_size=0; static int16_t out_buf[6*256*6]; #ifdef TIMING static inline long long rdtsc() { long long l; asm volatile( "rdtsc\n\t" : "=A" (l) ); // printf("%d\n", int(l/1000)); return l; } #define STARTTIMING t=rdtsc(); #define ENDTIMING sum+=rdtsc()-t; t=rdtsc(); #else #define STARTTIMING ; #define ENDTIMING ; #endif int main(){ int accel=0; int sample_rate=0; int bit_rate=0; #ifdef TIMING long long t, sum=0, min=256*256*256*64; #endif FILE *temp= stdout; stdout= stderr; //EVIL HACK FIXME GetCpuCaps(&gCpuCaps); stdout= temp; // gCpuCaps.hasMMX=0; // gCpuCaps.hasSSE=0; if(gCpuCaps.hasMMX) accel |= MM_ACCEL_X86_MMX; if(gCpuCaps.hasMMX2) accel |= MM_ACCEL_X86_MMXEXT; if(gCpuCaps.hasSSE) accel |= MM_ACCEL_X86_SSE; if(gCpuCaps.has3DNow) accel |= MM_ACCEL_X86_3DNOW; // if(gCpuCaps.has3DNowExt) accel |= MM_ACCEL_X86_3DNOWEXT; samples = a52_init (accel); if (samples == NULL) { fprintf (stderr, "A52 init failed\n"); return 1; } while(1){ int length,i; int16_t *s16; sample_t level=1, bias=384; int flags=0; int channels=0; while(buf_size<7){ int c=getchar(); if(c<0) goto eof; buf[buf_size++]=c; } STARTTIMING length = a52_syncinfo (buf, &flags, &sample_rate, &bit_rate); ENDTIMING if(!length){ // bad file => resync memcpy(buf,buf+1,6); --buf_size; continue; } fprintf(stderr,"sync. %d bytes 0x%X %d Hz %d kbit\n",length,flags,sample_rate,bit_rate); while(buf_size<length){ buf[buf_size++]=getchar(); } buf_size=0; // decode: flags=A52_STEREO; //A52_STEREO; //A52_DOLBY; //A52_STEREO; // A52_DOLBY // A52_2F2R // A52_3F2R | A52_LFE channels=2; flags |= A52_ADJUST_LEVEL; STARTTIMING if (a52_frame (&state, buf, &flags, &level, bias)) { fprintf(stderr,"error at decoding\n"); continue; } ENDTIMING // a52_dynrng (&state, NULL, NULL); // disable dynamic range compensation STARTTIMING a52_resample_init(accel,flags,channels); s16 = out_buf; for (i = 0; i < 6; i++) { if (a52_block (&state, samples)) { fprintf(stderr,"error at sampling\n"); break; } // float->int + channels interleaving: s16+=a52_resample(samples,s16); ENDTIMING } #ifdef TIMING if(sum<min) min=sum; sum=0; #endif fwrite(out_buf,6*256*2*channels,1,stdout); } eof: #ifdef TIMING fprintf(stderr, "%4.4fk cycles ",min/1000.0); sum=0; #endif }