2 * Simple free lossless/lossy audio codec
3 * Copyright (c) 2004 Alex Beregszaszi
5 * This file is part of FFmpeg.
7 * FFmpeg is free software; you can redistribute it and/or
8 * modify it under the terms of the GNU Lesser General Public
9 * License as published by the Free Software Foundation; either
10 * version 2.1 of the License, or (at your option) any later version.
12 * FFmpeg is distributed in the hope that it will be useful,
13 * but WITHOUT ANY WARRANTY; without even the implied warranty of
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
15 * Lesser General Public License for more details.
17 * You should have received a copy of the GNU Lesser General Public
18 * License along with FFmpeg; if not, write to the Free Software
19 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
27 * Simple free lossless/lossy audio codec
28 * Based on Paul Francis Harrison's Bonk (http://www.logarithmic.net/pfh/bonk)
29 * Written and designed by Alex Beregszaszi
32 * - CABAC put/get_symbol
33 * - independent quantizer for channels
34 * - >2 channels support
35 * - more decorrelation types
36 * - more tap_quant tests
37 * - selectable intlist writers/readers (bonk-style, golomb, cabac)
40 #define MAX_CHANNELS 2
46 typedef struct SonicContext {
48 int lossless, decorrelation;
50 int num_taps, downsampling;
53 int channels, samplerate, block_align, frame_size;
57 int *coded_samples[MAX_CHANNELS];
67 int *predictor_state[MAX_CHANNELS];
70 #define LATTICE_SHIFT 10
71 #define SAMPLE_SHIFT 4
72 #define LATTICE_FACTOR (1 << LATTICE_SHIFT)
73 #define SAMPLE_FACTOR (1 << SAMPLE_SHIFT)
75 #define BASE_QUANT 0.6
76 #define RATE_VARIATION 3.0
78 static inline int divide(int a, int b)
81 return -( (-a + b/2)/b );
86 static inline int shift(int a,int b)
88 return (a+(1<<(b-1))) >> b;
91 static inline int shift_down(int a,int b)
93 return (a>>b)+((a<0)?1:0);
97 static inline int intlist_write(PutBitContext *pb, int *buf, int entries, int base_2_part)
101 for (i = 0; i < entries; i++)
102 set_se_golomb(pb, buf[i]);
107 static inline int intlist_read(GetBitContext *gb, int *buf, int entries, int base_2_part)
111 for (i = 0; i < entries; i++)
112 buf[i] = get_se_golomb(gb);
119 #define ADAPT_LEVEL 8
121 static int bits_to_store(uint64_t x)
133 static void write_uint_max(PutBitContext *pb, unsigned int value, unsigned int max)
140 bits = bits_to_store(max);
142 for (i = 0; i < bits-1; i++)
143 put_bits(pb, 1, value & (1 << i));
145 if ( (value | (1 << (bits-1))) <= max)
146 put_bits(pb, 1, value & (1 << (bits-1)));
149 static unsigned int read_uint_max(GetBitContext *gb, int max)
151 int i, bits, value = 0;
156 bits = bits_to_store(max);
158 for (i = 0; i < bits-1; i++)
162 if ( (value | (1<<(bits-1))) <= max)
164 value += 1 << (bits-1);
169 static int intlist_write(PutBitContext *pb, int *buf, int entries, int base_2_part)
171 int i, j, x = 0, low_bits = 0, max = 0;
172 int step = 256, pos = 0, dominant = 0, any = 0;
175 copy = av_mallocz(4* entries);
183 for (i = 0; i < entries; i++)
184 energy += abs(buf[i]);
186 low_bits = bits_to_store(energy / (entries * 2));
190 put_bits(pb, 4, low_bits);
193 for (i = 0; i < entries; i++)
195 put_bits(pb, low_bits, abs(buf[i]));
196 copy[i] = abs(buf[i]) >> low_bits;
201 bits = av_mallocz(4* entries*max);
208 for (i = 0; i <= max; i++)
210 for (j = 0; j < entries; j++)
212 bits[x++] = copy[j] > i;
218 int steplet = step >> 8;
220 if (pos + steplet > x)
223 for (i = 0; i < steplet; i++)
224 if (bits[i+pos] != dominant)
227 put_bits(pb, 1, any);
232 step += step / ADAPT_LEVEL;
238 while (((pos + interloper) < x) && (bits[pos + interloper] == dominant))
242 write_uint_max(pb, interloper, (step >> 8) - 1);
244 pos += interloper + 1;
245 step -= step / ADAPT_LEVEL;
251 dominant = !dominant;
256 for (i = 0; i < entries; i++)
258 put_bits(pb, 1, buf[i] < 0);
266 static int intlist_read(GetBitContext *gb, int *buf, int entries, int base_2_part)
268 int i, low_bits = 0, x = 0;
269 int n_zeros = 0, step = 256, dominant = 0;
270 int pos = 0, level = 0;
271 int *bits = av_mallocz(4* entries);
278 low_bits = get_bits(gb, 4);
281 for (i = 0; i < entries; i++)
282 buf[i] = get_bits(gb, low_bits);
285 // av_log(NULL, AV_LOG_INFO, "entries: %d, low bits: %d\n", entries, low_bits);
287 while (n_zeros < entries)
289 int steplet = step >> 8;
293 for (i = 0; i < steplet; i++)
294 bits[x++] = dominant;
299 step += step / ADAPT_LEVEL;
303 int actual_run = read_uint_max(gb, steplet-1);
305 // av_log(NULL, AV_LOG_INFO, "actual run: %d\n", actual_run);
307 for (i = 0; i < actual_run; i++)
308 bits[x++] = dominant;
310 bits[x++] = !dominant;
313 n_zeros += actual_run;
317 step -= step / ADAPT_LEVEL;
323 dominant = !dominant;
327 // reconstruct unsigned values
329 for (i = 0; n_zeros < entries; i++)
336 level += 1 << low_bits;
339 if (buf[pos] >= level)
346 buf[pos] += 1 << low_bits;
355 for (i = 0; i < entries; i++)
356 if (buf[i] && get_bits1(gb))
359 // av_log(NULL, AV_LOG_INFO, "zeros: %d pos: %d\n", n_zeros, pos);
365 static void predictor_init_state(int *k, int *state, int order)
369 for (i = order-2; i >= 0; i--)
371 int j, p, x = state[i];
373 for (j = 0, p = i+1; p < order; j++,p++)
375 int tmp = x + shift_down(k[j] * state[p], LATTICE_SHIFT);
376 state[p] += shift_down(k[j]*x, LATTICE_SHIFT);
382 static int predictor_calc_error(int *k, int *state, int order, int error)
384 int i, x = error - shift_down(k[order-1] * state[order-1], LATTICE_SHIFT);
387 int *k_ptr = &(k[order-2]),
388 *state_ptr = &(state[order-2]);
389 for (i = order-2; i >= 0; i--, k_ptr--, state_ptr--)
391 int k_value = *k_ptr, state_value = *state_ptr;
392 x -= shift_down(k_value * state_value, LATTICE_SHIFT);
393 state_ptr[1] = state_value + shift_down(k_value * x, LATTICE_SHIFT);
396 for (i = order-2; i >= 0; i--)
398 x -= shift_down(k[i] * state[i], LATTICE_SHIFT);
399 state[i+1] = state[i] + shift_down(k[i] * x, LATTICE_SHIFT);
403 // don't drift too far, to avoid overflows
404 if (x > (SAMPLE_FACTOR<<16)) x = (SAMPLE_FACTOR<<16);
405 if (x < -(SAMPLE_FACTOR<<16)) x = -(SAMPLE_FACTOR<<16);
412 #if CONFIG_SONIC_ENCODER || CONFIG_SONIC_LS_ENCODER
413 // Heavily modified Levinson-Durbin algorithm which
414 // copes better with quantization, and calculates the
415 // actual whitened result as it goes.
417 static void modified_levinson_durbin(int *window, int window_entries,
418 int *out, int out_entries, int channels, int *tap_quant)
421 int *state = av_mallocz(4* window_entries);
423 memcpy(state, window, 4* window_entries);
425 for (i = 0; i < out_entries; i++)
427 int step = (i+1)*channels, k, j;
428 double xx = 0.0, xy = 0.0;
430 int *x_ptr = &(window[step]), *state_ptr = &(state[0]);
431 j = window_entries - step;
432 for (;j>=0;j--,x_ptr++,state_ptr++)
434 double x_value = *x_ptr, state_value = *state_ptr;
435 xx += state_value*state_value;
436 xy += x_value*state_value;
439 for (j = 0; j <= (window_entries - step); j++);
441 double stepval = window[step+j], stateval = window[j];
442 // xx += (double)window[j]*(double)window[j];
443 // xy += (double)window[step+j]*(double)window[j];
444 xx += stateval*stateval;
445 xy += stepval*stateval;
451 k = (int)(floor(-xy/xx * (double)LATTICE_FACTOR / (double)(tap_quant[i]) + 0.5));
453 if (k > (LATTICE_FACTOR/tap_quant[i]))
454 k = LATTICE_FACTOR/tap_quant[i];
455 if (-k > (LATTICE_FACTOR/tap_quant[i]))
456 k = -(LATTICE_FACTOR/tap_quant[i]);
462 x_ptr = &(window[step]);
463 state_ptr = &(state[0]);
464 j = window_entries - step;
465 for (;j>=0;j--,x_ptr++,state_ptr++)
467 int x_value = *x_ptr, state_value = *state_ptr;
468 *x_ptr = x_value + shift_down(k*state_value,LATTICE_SHIFT);
469 *state_ptr = state_value + shift_down(k*x_value, LATTICE_SHIFT);
472 for (j=0; j <= (window_entries - step); j++)
474 int stepval = window[step+j], stateval=state[j];
475 window[step+j] += shift_down(k * stateval, LATTICE_SHIFT);
476 state[j] += shift_down(k * stepval, LATTICE_SHIFT);
484 static inline int code_samplerate(int samplerate)
488 case 44100: return 0;
489 case 22050: return 1;
490 case 11025: return 2;
491 case 96000: return 3;
492 case 48000: return 4;
493 case 32000: return 5;
494 case 24000: return 6;
495 case 16000: return 7;
501 static av_cold int sonic_encode_init(AVCodecContext *avctx)
503 SonicContext *s = avctx->priv_data;
507 if (avctx->channels > MAX_CHANNELS)
509 av_log(avctx, AV_LOG_ERROR, "Only mono and stereo streams are supported by now\n");
510 return -1; /* only stereo or mono for now */
513 if (avctx->channels == 2)
514 s->decorrelation = MID_SIDE;
516 if (avctx->codec->id == CODEC_ID_SONIC_LS)
521 s->quantization = 0.0;
527 s->quantization = 1.0;
531 if ((s->num_taps < 32) || (s->num_taps > 1024) ||
532 ((s->num_taps>>5)<<5 != s->num_taps))
534 av_log(avctx, AV_LOG_ERROR, "Invalid number of taps\n");
539 s->tap_quant = av_mallocz(4* s->num_taps);
540 for (i = 0; i < s->num_taps; i++)
541 s->tap_quant[i] = (int)(sqrt(i+1));
543 s->channels = avctx->channels;
544 s->samplerate = avctx->sample_rate;
546 s->block_align = (int)(2048.0*s->samplerate/44100)/s->downsampling;
547 s->frame_size = s->channels*s->block_align*s->downsampling;
549 s->tail = av_mallocz(4* s->num_taps*s->channels);
552 s->tail_size = s->num_taps*s->channels;
554 s->predictor_k = av_mallocz(4 * s->num_taps);
558 for (i = 0; i < s->channels; i++)
560 s->coded_samples[i] = av_mallocz(4* s->block_align);
561 if (!s->coded_samples[i])
565 s->int_samples = av_mallocz(4* s->frame_size);
567 s->window_size = ((2*s->tail_size)+s->frame_size);
568 s->window = av_mallocz(4* s->window_size);
572 avctx->extradata = av_mallocz(16);
573 if (!avctx->extradata)
575 init_put_bits(&pb, avctx->extradata, 16*8);
577 put_bits(&pb, 2, version); // version
580 put_bits(&pb, 2, s->channels);
581 put_bits(&pb, 4, code_samplerate(s->samplerate));
583 put_bits(&pb, 1, s->lossless);
585 put_bits(&pb, 3, SAMPLE_SHIFT); // XXX FIXME: sample precision
586 put_bits(&pb, 2, s->decorrelation);
587 put_bits(&pb, 2, s->downsampling);
588 put_bits(&pb, 5, (s->num_taps >> 5)-1); // 32..1024
589 put_bits(&pb, 1, 0); // XXX FIXME: no custom tap quant table
592 avctx->extradata_size = put_bits_count(&pb)/8;
594 av_log(avctx, AV_LOG_INFO, "Sonic: ver: %d ls: %d dr: %d taps: %d block: %d frame: %d downsamp: %d\n",
595 version, s->lossless, s->decorrelation, s->num_taps, s->block_align, s->frame_size, s->downsampling);
597 avctx->coded_frame = avcodec_alloc_frame();
598 if (!avctx->coded_frame)
599 return AVERROR(ENOMEM);
600 avctx->coded_frame->key_frame = 1;
601 avctx->frame_size = s->block_align*s->downsampling;
606 static av_cold int sonic_encode_close(AVCodecContext *avctx)
608 SonicContext *s = avctx->priv_data;
611 av_freep(&avctx->coded_frame);
613 for (i = 0; i < s->channels; i++)
614 av_free(s->coded_samples[i]);
616 av_free(s->predictor_k);
618 av_free(s->tap_quant);
620 av_free(s->int_samples);
625 static int sonic_encode_frame(AVCodecContext *avctx,
626 uint8_t *buf, int buf_size, void *data)
628 SonicContext *s = avctx->priv_data;
630 int i, j, ch, quant = 0, x = 0;
631 short *samples = data;
633 init_put_bits(&pb, buf, buf_size*8);
636 for (i = 0; i < s->frame_size; i++)
637 s->int_samples[i] = samples[i];
640 for (i = 0; i < s->frame_size; i++)
641 s->int_samples[i] = s->int_samples[i] << SAMPLE_SHIFT;
643 switch(s->decorrelation)
646 for (i = 0; i < s->frame_size; i += s->channels)
648 s->int_samples[i] += s->int_samples[i+1];
649 s->int_samples[i+1] -= shift(s->int_samples[i], 1);
653 for (i = 0; i < s->frame_size; i += s->channels)
654 s->int_samples[i+1] -= s->int_samples[i];
657 for (i = 0; i < s->frame_size; i += s->channels)
658 s->int_samples[i] -= s->int_samples[i+1];
662 memset(s->window, 0, 4* s->window_size);
664 for (i = 0; i < s->tail_size; i++)
665 s->window[x++] = s->tail[i];
667 for (i = 0; i < s->frame_size; i++)
668 s->window[x++] = s->int_samples[i];
670 for (i = 0; i < s->tail_size; i++)
673 for (i = 0; i < s->tail_size; i++)
674 s->tail[i] = s->int_samples[s->frame_size - s->tail_size + i];
677 modified_levinson_durbin(s->window, s->window_size,
678 s->predictor_k, s->num_taps, s->channels, s->tap_quant);
679 if (intlist_write(&pb, s->predictor_k, s->num_taps, 0) < 0)
682 for (ch = 0; ch < s->channels; ch++)
685 for (i = 0; i < s->block_align; i++)
688 for (j = 0; j < s->downsampling; j++, x += s->channels)
690 s->coded_samples[ch][i] = sum;
694 // simple rate control code
697 double energy1 = 0.0, energy2 = 0.0;
698 for (ch = 0; ch < s->channels; ch++)
700 for (i = 0; i < s->block_align; i++)
702 double sample = s->coded_samples[ch][i];
703 energy2 += sample*sample;
704 energy1 += fabs(sample);
708 energy2 = sqrt(energy2/(s->channels*s->block_align));
709 energy1 = sqrt(2.0)*energy1/(s->channels*s->block_align);
711 // increase bitrate when samples are like a gaussian distribution
712 // reduce bitrate when samples are like a two-tailed exponential distribution
714 if (energy2 > energy1)
715 energy2 += (energy2-energy1)*RATE_VARIATION;
717 quant = (int)(BASE_QUANT*s->quantization*energy2/SAMPLE_FACTOR);
718 // av_log(avctx, AV_LOG_DEBUG, "quant: %d energy: %f / %f\n", quant, energy1, energy2);
725 set_ue_golomb(&pb, quant);
727 quant *= SAMPLE_FACTOR;
730 // write out coded samples
731 for (ch = 0; ch < s->channels; ch++)
734 for (i = 0; i < s->block_align; i++)
735 s->coded_samples[ch][i] = divide(s->coded_samples[ch][i], quant);
737 if (intlist_write(&pb, s->coded_samples[ch], s->block_align, 1) < 0)
741 // av_log(avctx, AV_LOG_DEBUG, "used bytes: %d\n", (put_bits_count(&pb)+7)/8);
744 return (put_bits_count(&pb)+7)/8;
746 #endif /* CONFIG_SONIC_ENCODER || CONFIG_SONIC_LS_ENCODER */
748 #if CONFIG_SONIC_DECODER
749 static const int samplerate_table[] =
750 { 44100, 22050, 11025, 96000, 48000, 32000, 24000, 16000, 8000 };
752 static av_cold int sonic_decode_init(AVCodecContext *avctx)
754 SonicContext *s = avctx->priv_data;
758 s->channels = avctx->channels;
759 s->samplerate = avctx->sample_rate;
761 avcodec_get_frame_defaults(&s->frame);
762 avctx->coded_frame = &s->frame;
764 if (!avctx->extradata)
766 av_log(avctx, AV_LOG_ERROR, "No mandatory headers present\n");
770 init_get_bits(&gb, avctx->extradata, avctx->extradata_size);
772 version = get_bits(&gb, 2);
775 av_log(avctx, AV_LOG_ERROR, "Unsupported Sonic version, please report\n");
781 s->channels = get_bits(&gb, 2);
782 s->samplerate = samplerate_table[get_bits(&gb, 4)];
783 av_log(avctx, AV_LOG_INFO, "Sonicv2 chans: %d samprate: %d\n",
784 s->channels, s->samplerate);
787 if (s->channels > MAX_CHANNELS)
789 av_log(avctx, AV_LOG_ERROR, "Only mono and stereo streams are supported by now\n");
793 s->lossless = get_bits1(&gb);
795 skip_bits(&gb, 3); // XXX FIXME
796 s->decorrelation = get_bits(&gb, 2);
798 s->downsampling = get_bits(&gb, 2);
799 if (!s->downsampling) {
800 av_log(avctx, AV_LOG_ERROR, "invalid downsampling value\n");
801 return AVERROR_INVALIDDATA;
804 s->num_taps = (get_bits(&gb, 5)+1)<<5;
805 if (get_bits1(&gb)) // XXX FIXME
806 av_log(avctx, AV_LOG_INFO, "Custom quant table\n");
808 s->block_align = (int)(2048.0*s->samplerate/44100)/s->downsampling;
809 s->frame_size = s->channels*s->block_align*s->downsampling;
810 // avctx->frame_size = s->block_align;
812 av_log(avctx, AV_LOG_INFO, "Sonic: ver: %d ls: %d dr: %d taps: %d block: %d frame: %d downsamp: %d\n",
813 version, s->lossless, s->decorrelation, s->num_taps, s->block_align, s->frame_size, s->downsampling);
816 s->tap_quant = av_mallocz(4* s->num_taps);
817 for (i = 0; i < s->num_taps; i++)
818 s->tap_quant[i] = (int)(sqrt(i+1));
820 s->predictor_k = av_mallocz(4* s->num_taps);
822 for (i = 0; i < s->channels; i++)
824 s->predictor_state[i] = av_mallocz(4* s->num_taps);
825 if (!s->predictor_state[i])
829 for (i = 0; i < s->channels; i++)
831 s->coded_samples[i] = av_mallocz(4* s->block_align);
832 if (!s->coded_samples[i])
835 s->int_samples = av_mallocz(4* s->frame_size);
837 avctx->sample_fmt = AV_SAMPLE_FMT_S16;
841 static av_cold int sonic_decode_close(AVCodecContext *avctx)
843 SonicContext *s = avctx->priv_data;
846 av_free(s->int_samples);
847 av_free(s->tap_quant);
848 av_free(s->predictor_k);
850 for (i = 0; i < s->channels; i++)
852 av_free(s->predictor_state[i]);
853 av_free(s->coded_samples[i]);
859 static int sonic_decode_frame(AVCodecContext *avctx,
860 void *data, int *got_frame_ptr,
863 const uint8_t *buf = avpkt->data;
864 int buf_size = avpkt->size;
865 SonicContext *s = avctx->priv_data;
867 int i, quant, ch, j, ret;
870 if (buf_size == 0) return 0;
872 s->frame.nb_samples = s->frame_size;
873 if ((ret = avctx->get_buffer(avctx, &s->frame)) < 0) {
874 av_log(avctx, AV_LOG_ERROR, "get_buffer() failed\n");
877 samples = (int16_t *)s->frame.data[0];
879 // av_log(NULL, AV_LOG_INFO, "buf_size: %d\n", buf_size);
881 init_get_bits(&gb, buf, buf_size*8);
883 intlist_read(&gb, s->predictor_k, s->num_taps, 0);
886 for (i = 0; i < s->num_taps; i++)
887 s->predictor_k[i] *= s->tap_quant[i];
892 quant = get_ue_golomb(&gb) * SAMPLE_FACTOR;
894 // av_log(NULL, AV_LOG_INFO, "quant: %d\n", quant);
896 for (ch = 0; ch < s->channels; ch++)
900 predictor_init_state(s->predictor_k, s->predictor_state[ch], s->num_taps);
902 intlist_read(&gb, s->coded_samples[ch], s->block_align, 1);
904 for (i = 0; i < s->block_align; i++)
906 for (j = 0; j < s->downsampling - 1; j++)
908 s->int_samples[x] = predictor_calc_error(s->predictor_k, s->predictor_state[ch], s->num_taps, 0);
912 s->int_samples[x] = predictor_calc_error(s->predictor_k, s->predictor_state[ch], s->num_taps, s->coded_samples[ch][i] * quant);
916 for (i = 0; i < s->num_taps; i++)
917 s->predictor_state[ch][i] = s->int_samples[s->frame_size - s->channels + ch - i*s->channels];
920 switch(s->decorrelation)
923 for (i = 0; i < s->frame_size; i += s->channels)
925 s->int_samples[i+1] += shift(s->int_samples[i], 1);
926 s->int_samples[i] -= s->int_samples[i+1];
930 for (i = 0; i < s->frame_size; i += s->channels)
931 s->int_samples[i+1] += s->int_samples[i];
934 for (i = 0; i < s->frame_size; i += s->channels)
935 s->int_samples[i] += s->int_samples[i+1];
940 for (i = 0; i < s->frame_size; i++)
941 s->int_samples[i] = shift(s->int_samples[i], SAMPLE_SHIFT);
944 for (i = 0; i < s->frame_size; i++)
945 samples[i] = av_clip_int16(s->int_samples[i]);
950 *(AVFrame*)data = s->frame;
952 return (get_bits_count(&gb)+7)/8;
955 AVCodec ff_sonic_decoder = {
957 .type = AVMEDIA_TYPE_AUDIO,
958 .id = CODEC_ID_SONIC,
959 .priv_data_size = sizeof(SonicContext),
960 .init = sonic_decode_init,
961 .close = sonic_decode_close,
962 .decode = sonic_decode_frame,
963 .capabilities = CODEC_CAP_DR1 | CODEC_CAP_EXPERIMENTAL,
964 .long_name = NULL_IF_CONFIG_SMALL("Sonic"),
966 #endif /* CONFIG_SONIC_DECODER */
968 #if CONFIG_SONIC_ENCODER
969 AVCodec ff_sonic_encoder = {
971 .type = AVMEDIA_TYPE_AUDIO,
972 .id = CODEC_ID_SONIC,
973 .priv_data_size = sizeof(SonicContext),
974 .init = sonic_encode_init,
975 .encode = sonic_encode_frame,
976 .capabilities = CODEC_CAP_EXPERIMENTAL,
977 .close = sonic_encode_close,
978 .long_name = NULL_IF_CONFIG_SMALL("Sonic"),
982 #if CONFIG_SONIC_LS_ENCODER
983 AVCodec ff_sonic_ls_encoder = {
985 .type = AVMEDIA_TYPE_AUDIO,
986 .id = CODEC_ID_SONIC_LS,
987 .priv_data_size = sizeof(SonicContext),
988 .init = sonic_encode_init,
989 .encode = sonic_encode_frame,
990 .capabilities = CODEC_CAP_EXPERIMENTAL,
991 .close = sonic_encode_close,
992 .long_name = NULL_IF_CONFIG_SMALL("Sonic lossless"),