comparison sonic.c @ 7782:6efb15a24e91 libavcodec

Replace generic CONFIG_ENCODERS preprocessor conditionals by more specific CONFIG_FOO_ENCODER conditionals where appropriate.
author diego
date Wed, 03 Sep 2008 12:33:21 +0000
parents dbcdd0165e55
children 7a463923ecd1
comparison
equal deleted inserted replaced
7781:0d62fafc69ae 7782:6efb15a24e91
406 state[0] = x; 406 state[0] = x;
407 407
408 return x; 408 return x;
409 } 409 }
410 410
411 #ifdef CONFIG_ENCODERS 411 #if defined(CONFIG_SONIC_ENCODER) || defined(CONFIG_SONIC_LS_ENCODER)
412 // Heavily modified Levinson-Durbin algorithm which 412 // Heavily modified Levinson-Durbin algorithm which
413 // copes better with quantization, and calculates the 413 // copes better with quantization, and calculates the
414 // actual whitened result as it goes. 414 // actual whitened result as it goes.
415 415
416 static void modified_levinson_durbin(int *window, int window_entries, 416 static void modified_levinson_durbin(int *window, int window_entries,
477 #endif 477 #endif
478 } 478 }
479 479
480 av_free(state); 480 av_free(state);
481 } 481 }
482 #endif /* CONFIG_ENCODERS */ 482 #endif /* defined(CONFIG_SONIC_ENCODER) || defined(CONFIG_SONIC_LS_ENCODER) */
483 483
484 static const int samplerate_table[] = 484 static const int samplerate_table[] =
485 { 44100, 22050, 11025, 96000, 48000, 32000, 24000, 16000, 8000 }; 485 { 44100, 22050, 11025, 96000, 48000, 32000, 24000, 16000, 8000 };
486 486
487 #ifdef CONFIG_ENCODERS 487 #if defined(CONFIG_SONIC_ENCODER) || defined(CONFIG_SONIC_LS_ENCODER)
488
489 static inline int code_samplerate(int samplerate) 488 static inline int code_samplerate(int samplerate)
490 { 489 {
491 switch (samplerate) 490 switch (samplerate)
492 { 491 {
493 case 44100: return 0; 492 case 44100: return 0;
746 // av_log(avctx, AV_LOG_DEBUG, "used bytes: %d\n", (put_bits_count(&pb)+7)/8); 745 // av_log(avctx, AV_LOG_DEBUG, "used bytes: %d\n", (put_bits_count(&pb)+7)/8);
747 746
748 flush_put_bits(&pb); 747 flush_put_bits(&pb);
749 return (put_bits_count(&pb)+7)/8; 748 return (put_bits_count(&pb)+7)/8;
750 } 749 }
751 #endif //CONFIG_ENCODERS 750 #endif /* defined(CONFIG_SONIC_ENCODER) || defined(CONFIG_SONIC_LS_ENCODER) */
752 751
753 #ifdef CONFIG_SONIC_DECODER 752 #ifdef CONFIG_SONIC_DECODER
754 static av_cold int sonic_decode_init(AVCodecContext *avctx) 753 static av_cold int sonic_decode_init(AVCodecContext *avctx)
755 { 754 {
756 SonicContext *s = avctx->priv_data; 755 SonicContext *s = avctx->priv_data;
935 934
936 return (get_bits_count(&gb)+7)/8; 935 return (get_bits_count(&gb)+7)/8;
937 } 936 }
938 #endif /* CONFIG_SONIC_DECODER */ 937 #endif /* CONFIG_SONIC_DECODER */
939 938
940 #ifdef CONFIG_ENCODERS 939 #ifdef CONFIG_SONIC_ENCODER
941 AVCodec sonic_encoder = { 940 AVCodec sonic_encoder = {
942 "sonic", 941 "sonic",
943 CODEC_TYPE_AUDIO, 942 CODEC_TYPE_AUDIO,
944 CODEC_ID_SONIC, 943 CODEC_ID_SONIC,
945 sizeof(SonicContext), 944 sizeof(SonicContext),
947 sonic_encode_frame, 946 sonic_encode_frame,
948 sonic_encode_close, 947 sonic_encode_close,
949 NULL, 948 NULL,
950 .long_name = NULL_IF_CONFIG_SMALL("Sonic"), 949 .long_name = NULL_IF_CONFIG_SMALL("Sonic"),
951 }; 950 };
952 951 #endif
952
953 #ifdef CONFIG_SONIC_LS_ENCODER
953 AVCodec sonic_ls_encoder = { 954 AVCodec sonic_ls_encoder = {
954 "sonicls", 955 "sonicls",
955 CODEC_TYPE_AUDIO, 956 CODEC_TYPE_AUDIO,
956 CODEC_ID_SONIC_LS, 957 CODEC_ID_SONIC_LS,
957 sizeof(SonicContext), 958 sizeof(SonicContext),