[FFmpeg-devel] [PATCH] dsicinav: reduce cinaudio_delta16_table
Reimar Döffinger
Reimar.Doeffinger
Wed Jul 2 20:02:36 CEST 2008
On Wed, Jul 02, 2008 at 07:12:03PM +0200, Gregory Montoir wrote:
> Index: libavcodec/dsicinav.c
> ===================================================================
> --- libavcodec/dsicinav.c (r?vision 14047)
> +++ libavcodec/dsicinav.c (copie de travail)
> @@ -50,23 +50,7 @@
>
>
> /* table defining a geometric sequence with multiplier = 32767 ^ (1 / 128) */
> -static const int16_t cinaudio_delta16_table[256] = {
> - 0, 0, 0, 0, 0, 0, 0, 0,
> - 0, 0, 0, 0, 0, 0, 0, 0,
> - 0, 0, 0, -30210, -27853, -25680, -23677, -21829,
> - -20126, -18556, -17108, -15774, -14543, -13408, -12362, -11398,
> - -10508, -9689, -8933, -8236, -7593, -7001, -6455, -5951,
> - -5487, -5059, -4664, -4300, -3964, -3655, -3370, -3107,
> - -2865, -2641, -2435, -2245, -2070, -1908, -1759, -1622,
> - -1495, -1379, -1271, -1172, -1080, -996, -918, -847,
> - -781, -720, -663, -612, -564, -520, -479, -442,
> - -407, -376, -346, -319, -294, -271, -250, -230,
> - -212, -196, -181, -166, -153, -141, -130, -120,
> - -111, -102, -94, -87, -80, -74, -68, -62,
> - -58, -53, -49, -45, -41, -38, -35, -32,
> - -30, -27, -25, -23, -21, -20, -18, -17,
> - -15, -14, -13, -12, -11, -10, -9, -8,
> - -7, -6, -5, -4, -3, -2, -1, 0,
> +static const int16_t cinaudio_delta16_table[128] = {
> 0, 1, 2, 3, 4, 5, 6, 7,
> 8, 9, 10, 11, 12, 13, 14, 15,
> 17, 18, 20, 21, 23, 25, 27, 30,
> @@ -326,7 +310,11 @@
> buf_size -= 2;
> }
> while (buf_size > 0) {
> - cin->delta += cinaudio_delta16_table[*src++];
> + if (*src & 0x80)
> + cin->delta += cinaudio_delta16_table[*src - 128];
> + else
> + cin->delta -= cinaudio_delta16_table[127 - *src];
> + src++;
Well, it would be slightly simpler to keep the first part of the table
and do
> + if (*src & 0x80)
> + cin->delta -= cinaudio_delta16_table[255 - *src];
> + else
> + cin->delta += cinaudio_delta16_table[*src];
More information about the ffmpeg-devel
mailing list