OLD | NEW |
1 /* libFLAC - Free Lossless Audio Codec library | 1 /* libFLAC - Free Lossless Audio Codec library |
2 * Copyright (C) 2000,2001,2002,2003,2004,2005,2006,2007 Josh Coalson | 2 * Copyright (C) 2000-2009 Josh Coalson |
| 3 * Copyright (C) 2011-2014 Xiph.Org Foundation |
3 * | 4 * |
4 * Redistribution and use in source and binary forms, with or without | 5 * Redistribution and use in source and binary forms, with or without |
5 * modification, are permitted provided that the following conditions | 6 * modification, are permitted provided that the following conditions |
6 * are met: | 7 * are met: |
7 * | 8 * |
8 * - Redistributions of source code must retain the above copyright | 9 * - Redistributions of source code must retain the above copyright |
9 * notice, this list of conditions and the following disclaimer. | 10 * notice, this list of conditions and the following disclaimer. |
10 * | 11 * |
11 * - Redistributions in binary form must reproduce the above copyright | 12 * - Redistributions in binary form must reproduce the above copyright |
12 * notice, this list of conditions and the following disclaimer in the | 13 * notice, this list of conditions and the following disclaimer in the |
(...skipping 108 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
121 * In more detail, the stream encoder functions similarly to the | 122 * In more detail, the stream encoder functions similarly to the |
122 * \link flac_stream_decoder stream decoder \endlink, but has fewer | 123 * \link flac_stream_decoder stream decoder \endlink, but has fewer |
123 * callbacks and more options. Typically the client will create a new | 124 * callbacks and more options. Typically the client will create a new |
124 * instance by calling FLAC__stream_encoder_new(), then set the necessary | 125 * instance by calling FLAC__stream_encoder_new(), then set the necessary |
125 * parameters with FLAC__stream_encoder_set_*(), and initialize it by | 126 * parameters with FLAC__stream_encoder_set_*(), and initialize it by |
126 * calling one of the FLAC__stream_encoder_init_*() functions. | 127 * calling one of the FLAC__stream_encoder_init_*() functions. |
127 * | 128 * |
128 * Unlike the decoders, the stream encoder has many options that can | 129 * Unlike the decoders, the stream encoder has many options that can |
129 * affect the speed and compression ratio. When setting these parameters | 130 * affect the speed and compression ratio. When setting these parameters |
130 * you should have some basic knowledge of the format (see the | 131 * you should have some basic knowledge of the format (see the |
131 * <A HREF="../documentation.html#format">user-level documentation</A> | 132 * <A HREF="../documentation_format_overview.html">user-level documentation</A> |
132 * or the <A HREF="../format.html">formal description</A>). The | 133 * or the <A HREF="../format.html">formal description</A>). The |
133 * FLAC__stream_encoder_set_*() functions themselves do not validate the | 134 * FLAC__stream_encoder_set_*() functions themselves do not validate the |
134 * values as many are interdependent. The FLAC__stream_encoder_init_*() | 135 * values as many are interdependent. The FLAC__stream_encoder_init_*() |
135 * functions will do this, so make sure to pay attention to the state | 136 * functions will do this, so make sure to pay attention to the state |
136 * returned by FLAC__stream_encoder_init_*() to make sure that it is | 137 * returned by FLAC__stream_encoder_init_*() to make sure that it is |
137 * FLAC__STREAM_ENCODER_INIT_STATUS_OK. Any parameters that are not set | 138 * FLAC__STREAM_ENCODER_INIT_STATUS_OK. Any parameters that are not set |
138 * before FLAC__stream_encoder_init_*() will take on the defaults from | 139 * before FLAC__stream_encoder_init_*() will take on the defaults from |
139 * the constructor. | 140 * the constructor. |
140 * | 141 * |
141 * There are three initialization functions for native FLAC, one for | 142 * There are three initialization functions for native FLAC, one for |
(...skipping 680 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
822 * - FLAC__stream_encoder_set_do_qlp_coeff_prec_search() | 823 * - FLAC__stream_encoder_set_do_qlp_coeff_prec_search() |
823 * - FLAC__stream_encoder_set_do_escape_coding() | 824 * - FLAC__stream_encoder_set_do_escape_coding() |
824 * - FLAC__stream_encoder_set_do_exhaustive_model_search() | 825 * - FLAC__stream_encoder_set_do_exhaustive_model_search() |
825 * - FLAC__stream_encoder_set_min_residual_partition_order() | 826 * - FLAC__stream_encoder_set_min_residual_partition_order() |
826 * - FLAC__stream_encoder_set_max_residual_partition_order() | 827 * - FLAC__stream_encoder_set_max_residual_partition_order() |
827 * - FLAC__stream_encoder_set_rice_parameter_search_dist() | 828 * - FLAC__stream_encoder_set_rice_parameter_search_dist() |
828 * | 829 * |
829 * The actual values set for each level are: | 830 * The actual values set for each level are: |
830 * <table> | 831 * <table> |
831 * <tr> | 832 * <tr> |
832 * <td><b>level</b><td> | 833 * <td><b>level</b></td> |
833 * <td>do mid-side stereo<td> | 834 * <td>do mid-side stereo</td> |
834 * <td>loose mid-side stereo<td> | 835 * <td>loose mid-side stereo</td> |
835 * <td>apodization<td> | 836 * <td>apodization</td> |
836 * <td>max lpc order<td> | 837 * <td>max lpc order</td> |
837 * <td>qlp coeff precision<td> | 838 * <td>qlp coeff precision</td> |
838 * <td>qlp coeff prec search<td> | 839 * <td>qlp coeff prec search</td> |
839 * <td>escape coding<td> | 840 * <td>escape coding</td> |
840 * <td>exhaustive model search<td> | 841 * <td>exhaustive model search</td> |
841 * <td>min residual partition order<td> | 842 * <td>min residual partition order</td> |
842 * <td>max residual partition order<td> | 843 * <td>max residual partition order</td> |
843 * <td>rice parameter search dist<td> | 844 * <td>rice parameter search dist</td> |
844 * </tr> | 845 * </tr> |
845 * <tr> <td><b>0</b><td> <td>false<td> <td>false<td> <td>tukey(0.5)<td> <td
>0<td> <td>0<td> <td>false<td> <td>false<td> <td>false<td> <td>0<td> <td>
3<td> <td>0<td> </tr> | 846 * <tr> <td><b>0</b></td> <td>false</td> <td>false</td> <td>tukey(0.5)<td>
<td>0</td> <td>0</td> <td>false</td> <td>false<
/td> <td>false</td> <td>0</td> <td>3</td> <td>0</td> </tr> |
846 * <tr> <td><b>1</b><td> <td>true<td> <td>true<td> <td>tukey(0.5)<td> <td
>0<td> <td>0<td> <td>false<td> <td>false<td> <td>false<td> <td>0<td> <td>
3<td> <td>0<td> </tr> | 847 * <tr> <td><b>1</b></td> <td>true</td> <td>true</td> <td>tukey(0.5)<td>
<td>0</td> <td>0</td> <td>false</td> <td>false<
/td> <td>false</td> <td>0</td> <td>3</td> <td>0</td> </tr> |
847 * <tr> <td><b>2</b><td> <td>true<td> <td>false<td> <td>tukey(0.5)<td> <td
>0<td> <td>0<td> <td>false<td> <td>false<td> <td>false<td> <td>0<td> <td>
3<td> <td>0<td> </tr> | 848 * <tr> <td><b>2</b></td> <td>true</td> <td>false</td> <td>tukey(0.5)<td>
<td>0</td> <td>0</td> <td>false</td> <td>false<
/td> <td>false</td> <td>0</td> <td>3</td> <td>0</td> </tr> |
848 * <tr> <td><b>3</b><td> <td>false<td> <td>false<td> <td>tukey(0.5)<td> <td
>6<td> <td>0<td> <td>false<td> <td>false<td> <td>false<td> <td>0<td> <td>
4<td> <td>0<td> </tr> | 849 * <tr> <td><b>3</b></td> <td>false</td> <td>false</td> <td>tukey(0.5)<td>
<td>6</td> <td>0</td> <td>false</td> <td>false<
/td> <td>false</td> <td>0</td> <td>4</td> <td>0</td> </tr> |
849 * <tr> <td><b>4</b><td> <td>true<td> <td>true<td> <td>tukey(0.5)<td> <td
>8<td> <td>0<td> <td>false<td> <td>false<td> <td>false<td> <td>0<td> <td>
4<td> <td>0<td> </tr> | 850 * <tr> <td><b>4</b></td> <td>true</td> <td>true</td> <td>tukey(0.5)<td>
<td>8</td> <td>0</td> <td>false</td> <td>false<
/td> <td>false</td> <td>0</td> <td>4</td> <td>0</td> </tr> |
850 * <tr> <td><b>5</b><td> <td>true<td> <td>false<td> <td>tukey(0.5)<td> <td
>8<td> <td>0<td> <td>false<td> <td>false<td> <td>false<td> <td>0<td> <td>
5<td> <td>0<td> </tr> | 851 * <tr> <td><b>5</b></td> <td>true</td> <td>false</td> <td>tukey(0.5)<td>
<td>8</td> <td>0</td> <td>false</td> <td>false<
/td> <td>false</td> <td>0</td> <td>5</td> <td>0</td> </tr> |
851 * <tr> <td><b>6</b><td> <td>true<td> <td>false<td> <td>tukey(0.5)<td> <td
>8<td> <td>0<td> <td>false<td> <td>false<td> <td>false<td> <td>0<td> <td>
6<td> <td>0<td> </tr> | 852 * <tr> <td><b>6</b></td> <td>true</td> <td>false</td> <td>tukey(0.5);partial_
tukey(2)<td> <td>8</td> <td>0</td> <td>false</td> <td>false<
/td> <td>false</td> <td>0</td> <td>6</td> <td>0</td> </tr> |
852 * <tr> <td><b>7</b><td> <td>true<td> <td>false<td> <td>tukey(0.5)<td> <td
>8<td> <td>0<td> <td>false<td> <td>false<td> <td>true<td> <td>0<td> <td>
6<td> <td>0<td> </tr> | 853 * <tr> <td><b>7</b></td> <td>true</td> <td>false</td> <td>tukey(0.5);partial_
tukey(2)<td> <td>12</td> <td>0</td> <td>false</td> <td>false<
/td> <td>false</td> <td>0</td> <td>6</td> <td>0</td> </tr> |
853 * <tr> <td><b>8</b><td> <td>true<td> <td>false<td> <td>tukey(0.5)<td> <td
>12<td> <td>0<td> <td>false<td> <td>false<td> <td>true<td> <td>0<td> <td>
6<td> <td>0<td> </tr> | 854 * <tr> <td><b>8</b></td> <td>true</td> <td>false</td> <td>tukey(0.5);partial_
tukey(2);punchout_tukey(3)</td> <td>12</td> <td>0</td> <td>false</td> <td>false<
/td> <td>false</td> <td>0</td> <td>6</td> <td>0</td> </tr> |
854 * </table> | 855 * </table> |
855 * | 856 * |
856 * \default \c 5 | 857 * \default \c 5 |
857 * \param encoder An encoder instance to set. | 858 * \param encoder An encoder instance to set. |
858 * \param value See above. | 859 * \param value See above. |
859 * \assert | 860 * \assert |
860 * \code encoder != NULL \endcode | 861 * \code encoder != NULL \endcode |
861 * \retval FLAC__bool | 862 * \retval FLAC__bool |
862 * \c false if the encoder is already initialized, else \c true. | 863 * \c false if the encoder is already initialized, else \c true. |
863 */ | 864 */ |
(...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
912 * audio data for LPC analysis. | 913 * audio data for LPC analysis. |
913 * | 914 * |
914 * The \a specification is a plain ASCII string which specifies exactly | 915 * The \a specification is a plain ASCII string which specifies exactly |
915 * which functions to use. There may be more than one (up to 32), | 916 * which functions to use. There may be more than one (up to 32), |
916 * separated by \c ';' characters. Some functions take one or more | 917 * separated by \c ';' characters. Some functions take one or more |
917 * comma-separated arguments in parentheses. | 918 * comma-separated arguments in parentheses. |
918 * | 919 * |
919 * The available functions are \c bartlett, \c bartlett_hann, | 920 * The available functions are \c bartlett, \c bartlett_hann, |
920 * \c blackman, \c blackman_harris_4term_92db, \c connes, \c flattop, | 921 * \c blackman, \c blackman_harris_4term_92db, \c connes, \c flattop, |
921 * \c gauss(STDDEV), \c hamming, \c hann, \c kaiser_bessel, \c nuttall, | 922 * \c gauss(STDDEV), \c hamming, \c hann, \c kaiser_bessel, \c nuttall, |
922 * \c rectangle, \c triangle, \c tukey(P), \c welch. | 923 * \c rectangle, \c triangle, \c tukey(P), \c partial_tukey(n[/ov[/P]]), |
| 924 * \c punchout_tukey(n[/ov[/P]]), \c welch. |
923 * | 925 * |
924 * For \c gauss(STDDEV), STDDEV specifies the standard deviation | 926 * For \c gauss(STDDEV), STDDEV specifies the standard deviation |
925 * (0<STDDEV<=0.5). | 927 * (0<STDDEV<=0.5). |
926 * | 928 * |
927 * For \c tukey(P), P specifies the fraction of the window that is | 929 * For \c tukey(P), P specifies the fraction of the window that is |
928 * tapered (0<=P<=1). P=0 corresponds to \c rectangle and P=1 | 930 * tapered (0<=P<=1). P=0 corresponds to \c rectangle and P=1 |
929 * corresponds to \c hann. | 931 * corresponds to \c hann. |
930 * | 932 * |
| 933 * Specifying \c partial_tukey or \c punchout_tukey works a little |
| 934 * different. These do not specify a single apodization function, but |
| 935 * a series of them with some overlap. partial_tukey specifies a series |
| 936 * of small windows (all treated separately) while punchout_tukey |
| 937 * specifies a series of windows that have a hole in them. In this way, |
| 938 * the predictor is constructed with only a part of the block, which |
| 939 * helps in case a block consists of dissimilar parts. |
| 940 * |
| 941 * The three parameters that can be specified for the functions are |
| 942 * n, ov and P. n is the number of functions to add, ov is the overlap |
| 943 * of the windows in case of partial_tukey and the overlap in the gaps |
| 944 * in case of punchout_tukey. P is the fraction of the window that is |
| 945 * tapered, like with a regular tukey window. The function can be |
| 946 * specified with only a number, a number and an overlap, or a number |
| 947 * an overlap and a P, for example, partial_tukey(3), partial_tukey(3/0.3) |
| 948 * and partial_tukey(3/0.3/0.5) are all valid. ov should be smaller than 1 |
| 949 * and can be negative. |
| 950 * |
931 * Example specifications are \c "blackman" or | 951 * Example specifications are \c "blackman" or |
932 * \c "hann;triangle;tukey(0.5);tukey(0.25);tukey(0.125)" | 952 * \c "hann;triangle;tukey(0.5);tukey(0.25);tukey(0.125)" |
933 * | 953 * |
934 * Any function that is specified erroneously is silently dropped. Up | 954 * Any function that is specified erroneously is silently dropped. Up |
935 * to 32 functions are kept, the rest are dropped. If the specification | 955 * to 32 functions are kept, the rest are dropped. If the specification |
936 * is empty the encoder defaults to \c "tukey(0.5)". | 956 * is empty the encoder defaults to \c "tukey(0.5)". |
937 * | 957 * |
938 * When more than one function is specified, then for every subframe the | 958 * When more than one function is specified, then for every subframe the |
939 * encoder will try each of them separately and choose the window that | 959 * encoder will try each of them separately and choose the window that |
940 * results in the smallest compressed subframe. | 960 * results in the smallest compressed subframe. |
941 * | 961 * |
942 * Note that each function specified causes the encoder to occupy a | 962 * Note that each function specified causes the encoder to occupy a |
943 * floating point array in which to store the window. | 963 * floating point array in which to store the window. Also note that the |
| 964 * values of P, STDDEV and ov are locale-specific, so if the comma |
| 965 * separator specified by the locale is a comma, a comma should be used. |
944 * | 966 * |
945 * \default \c "tukey(0.5)" | 967 * \default \c "tukey(0.5)" |
946 * \param encoder An encoder instance to set. | 968 * \param encoder An encoder instance to set. |
947 * \param specification See above. | 969 * \param specification See above. |
948 * \assert | 970 * \assert |
949 * \code encoder != NULL \endcode | 971 * \code encoder != NULL \endcode |
950 * \code specification != NULL \endcode | 972 * \code specification != NULL \endcode |
951 * \retval FLAC__bool | 973 * \retval FLAC__bool |
952 * \c false if the encoder is already initialized, else \c true. | 974 * \c false if the encoder is already initialized, else \c true. |
953 */ | 975 */ |
(...skipping 805 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1759 */ | 1781 */ |
1760 FLAC_API FLAC__bool FLAC__stream_encoder_process_interleaved(FLAC__StreamEncoder
*encoder, const FLAC__int32 buffer[], unsigned samples); | 1782 FLAC_API FLAC__bool FLAC__stream_encoder_process_interleaved(FLAC__StreamEncoder
*encoder, const FLAC__int32 buffer[], unsigned samples); |
1761 | 1783 |
1762 /* \} */ | 1784 /* \} */ |
1763 | 1785 |
1764 #ifdef __cplusplus | 1786 #ifdef __cplusplus |
1765 } | 1787 } |
1766 #endif | 1788 #endif |
1767 | 1789 |
1768 #endif | 1790 #endif |
OLD | NEW |