# HG changeset patch # User vitor # Date 1255883350 0 # Node ID 1a3908177e87cd636a2caf1497a1e812c503ca20 # Parent 8d15af8161447239a7c2e83066aa0e8f3d739007 Replace big square-root table by a call to ff_sqrt(). Based on a patch by Reimar Dffinger. diff -r 8d15af816144 -r 1a3908177e87 roqaudioenc.c --- a/roqaudioenc.c Sun Oct 18 14:34:45 2009 +0000 +++ b/roqaudioenc.c Sun Oct 18 16:29:10 2009 +0000 @@ -29,7 +29,6 @@ #define MAX_DPCM (127*127) -static unsigned char dpcmValues[MAX_DPCM]; typedef struct @@ -37,18 +36,6 @@ short lastSample[2]; } ROQDPCMContext; -static av_cold void roq_dpcm_table_init(void) -{ - int i; - - /* Create a table of quick DPCM values */ - for (i=0; imid); - } -} - static av_cold int roq_dpcm_encode_init(AVCodecContext *avctx) { ROQDPCMContext *context = avctx->priv_data; @@ -66,8 +53,6 @@ return -1; } - roq_dpcm_table_init(); - avctx->frame_size = ROQ_FIRST_FRAME_SIZE; context->lastSample[0] = context->lastSample[1] = 0; @@ -92,8 +77,10 @@ if (diff >= MAX_DPCM) result = 127; - else - result = dpcmValues[diff]; + else { + result = ff_sqrt(diff); + result += diff > result*result+result; + } /* See if this overflows */ retry: