Mercurial > libavcodec.hg
comparison sonic.c @ 9955:4ebcb6c121e4 libavcodec
cosmetics: Move some code blocks to reduce the number of #ifdefs.
author | diego |
---|---|
date | Thu, 16 Jul 2009 21:37:58 +0000 |
parents | 0dce4fe6e6f3 |
children | 8a4984c5cacc |
comparison
equal
deleted
inserted
replaced
9954:50327500e065 | 9955:4ebcb6c121e4 |
---|---|
477 #endif | 477 #endif |
478 } | 478 } |
479 | 479 |
480 av_free(state); | 480 av_free(state); |
481 } | 481 } |
482 #endif /* CONFIG_SONIC_ENCODER || CONFIG_SONIC_LS_ENCODER */ | 482 |
483 | |
484 static const int samplerate_table[] = | |
485 { 44100, 22050, 11025, 96000, 48000, 32000, 24000, 16000, 8000 }; | |
486 | |
487 #if CONFIG_SONIC_ENCODER || CONFIG_SONIC_LS_ENCODER | |
488 static inline int code_samplerate(int samplerate) | 483 static inline int code_samplerate(int samplerate) |
489 { | 484 { |
490 switch (samplerate) | 485 switch (samplerate) |
491 { | 486 { |
492 case 44100: return 0; | 487 case 44100: return 0; |
748 return (put_bits_count(&pb)+7)/8; | 743 return (put_bits_count(&pb)+7)/8; |
749 } | 744 } |
750 #endif /* CONFIG_SONIC_ENCODER || CONFIG_SONIC_LS_ENCODER */ | 745 #endif /* CONFIG_SONIC_ENCODER || CONFIG_SONIC_LS_ENCODER */ |
751 | 746 |
752 #if CONFIG_SONIC_DECODER | 747 #if CONFIG_SONIC_DECODER |
748 static const int samplerate_table[] = | |
749 { 44100, 22050, 11025, 96000, 48000, 32000, 24000, 16000, 8000 }; | |
750 | |
753 static av_cold int sonic_decode_init(AVCodecContext *avctx) | 751 static av_cold int sonic_decode_init(AVCodecContext *avctx) |
754 { | 752 { |
755 SonicContext *s = avctx->priv_data; | 753 SonicContext *s = avctx->priv_data; |
756 GetBitContext gb; | 754 GetBitContext gb; |
757 int i, version; | 755 int i, version; |
934 | 932 |
935 *data_size = s->frame_size * 2; | 933 *data_size = s->frame_size * 2; |
936 | 934 |
937 return (get_bits_count(&gb)+7)/8; | 935 return (get_bits_count(&gb)+7)/8; |
938 } | 936 } |
937 | |
938 AVCodec sonic_decoder = { | |
939 "sonic", | |
940 CODEC_TYPE_AUDIO, | |
941 CODEC_ID_SONIC, | |
942 sizeof(SonicContext), | |
943 sonic_decode_init, | |
944 NULL, | |
945 sonic_decode_close, | |
946 sonic_decode_frame, | |
947 .long_name = NULL_IF_CONFIG_SMALL("Sonic"), | |
948 }; | |
939 #endif /* CONFIG_SONIC_DECODER */ | 949 #endif /* CONFIG_SONIC_DECODER */ |
940 | 950 |
941 #if CONFIG_SONIC_ENCODER | 951 #if CONFIG_SONIC_ENCODER |
942 AVCodec sonic_encoder = { | 952 AVCodec sonic_encoder = { |
943 "sonic", | 953 "sonic", |
963 sonic_encode_close, | 973 sonic_encode_close, |
964 NULL, | 974 NULL, |
965 .long_name = NULL_IF_CONFIG_SMALL("Sonic lossless"), | 975 .long_name = NULL_IF_CONFIG_SMALL("Sonic lossless"), |
966 }; | 976 }; |
967 #endif | 977 #endif |
968 | |
969 #if CONFIG_SONIC_DECODER | |
970 AVCodec sonic_decoder = { | |
971 "sonic", | |
972 CODEC_TYPE_AUDIO, | |
973 CODEC_ID_SONIC, | |
974 sizeof(SonicContext), | |
975 sonic_decode_init, | |
976 NULL, | |
977 sonic_decode_close, | |
978 sonic_decode_frame, | |
979 .long_name = NULL_IF_CONFIG_SMALL("Sonic"), | |
980 }; | |
981 #endif |