[FFmpeg-devel] [PATCH] change AVCodecContext.use_lpc to lpc_type and lpc_passes

Justin Ruggles justin.ruggles
Sun Jul 11 19:00:54 CEST 2010


Michael Niedermayer wrote:

> On Sat, Jul 10, 2010 at 01:07:37PM -0400, Justin Ruggles wrote:
>> Hi,
>>
>> New patch attached.
>>
>> Michael Niedermayer wrote:
>>
>>> On Wed, Jul 07, 2010 at 10:01:43PM -0400, Justin Ruggles wrote:
>>>> Hi,
>>>>
>>>> This patch adds 2 new fields to AVCodecContext, lpc_type and lpc_passes,
>>>> and deprecates use_lpc.  Separating the 2 makes more sense logically and
>>>> allows for adding of other LPC algorithms.  It also gives the user an
>>>> explicit option to not use LPC prediction.
>>>>
>>>> The generic LPC code and the FLAC and ALAC encoders are modified to use
>>>> the new fields.  FLAC currently uses the use_lpc field, so I've added
>>>> some backwards compatibility code.  The ALAC encoder does not, so it
>>>> adds functionality in addition to using the new fields.  I can separate
>>>> that into its own patch if desired.
>>> [...]
>>>> Index: libavcodec/options.c
>>>> ===================================================================
>>>> --- libavcodec/options.c	(revision 24100)
>>>> +++ libavcodec/options.c	(working copy)
>>>> @@ -382,7 +382,9 @@
>>>>  {"ivlc", "intra vlc table", 0, FF_OPT_TYPE_CONST, CODEC_FLAG2_INTRA_VLC, INT_MIN, INT_MAX, V|E, "flags2"},
>>>>  {"b_sensitivity", "adjusts sensitivity of b_frame_strategy 1", OFFSET(b_sensitivity), FF_OPT_TYPE_INT, 40, 1, INT_MAX, V|E},
>>>>  {"compression_level", NULL, OFFSET(compression_level), FF_OPT_TYPE_INT, FF_COMPRESSION_DEFAULT, INT_MIN, INT_MAX, V|A|E},
>>>> +#if LIBAVCODEC_VERSION_MAJOR < 53
>>>>  {"use_lpc", "sets whether to use LPC mode (FLAC)", OFFSET(use_lpc), FF_OPT_TYPE_INT, -1, INT_MIN, INT_MAX, A|E},
>>>> +#endif
>>>>  {"lpc_coeff_precision", "LPC coefficient precision (FLAC)", OFFSET(lpc_coeff_precision), FF_OPT_TYPE_INT, DEFAULT, 0, INT_MAX, A|E},
>>>>  {"min_prediction_order", NULL, OFFSET(min_prediction_order), FF_OPT_TYPE_INT, -1, INT_MIN, INT_MAX, A|E},
>>>>  {"max_prediction_order", NULL, OFFSET(max_prediction_order), FF_OPT_TYPE_INT, -1, INT_MIN, INT_MAX, A|E},
>>>> @@ -417,6 +419,12 @@
>>>>  {"intra_refresh", "use periodic insertion of intra blocks instead of keyframes", 0, FF_OPT_TYPE_CONST, CODEC_FLAG2_INTRA_REFRESH, INT_MIN, INT_MAX, V|E, "flags2"},
>>>>  {"crf_max", "in crf mode, prevents vbv from lowering quality beyond this point", OFFSET(crf_max), FF_OPT_TYPE_FLOAT, DEFAULT, 0, 51, V|E},
>>>>  {"log_level_offset", "set the log level offset", OFFSET(log_level_offset), FF_OPT_TYPE_INT, 0, INT_MIN, INT_MAX },
>>>> +{"lpc_type", "specify LPC algorithm", OFFSET(lpc_type), FF_OPT_TYPE_INT, FF_LPC_TYPE_DEFAULT, INT_MIN, INT_MAX, A|E},
>>> min/max dont look correct
>> fixed.
>>
>>
>>> [...]
>>>
>>>> @@ -2672,6 +2675,25 @@
>>>>      float crf_max;
>>>>  
>>>>      int log_level_offset;
>>>> +
>>>> +    /**
>>>> +     * Determines which LPC analysis algorithm to use.
>>>> +     * - encoding: Set by user
>>>> +     * - decoding: unused
>>>> +     */
>>>> +    int lpc_type;
>>>> +#define FF_LPC_TYPE_DEFAULT   -1
>>>> +#define FF_LPC_TYPE_NONE       0
>>>> +#define FF_LPC_TYPE_FIXED      1
>>>> +#define FF_LPC_TYPE_LEVINSON   2
>>>> +#define FF_LPC_TYPE_CHOLESKY   3
>>> this possibly should be an enum
>> fixed.
>>
>>> except above iam ok with the changes to files i maintain
> 
> changes to my files still look good

Applied.

Thanks,
Justin




More information about the ffmpeg-devel mailing list