On Fri, Feb 14, 2014 at 02:56:46AM -0500, Andrew Kelley wrote:
> This patch adds the `compand` audio filter from ffmpeg master branch
> (currently at 7f0f47b3df) adapted to work with libav.
> 
> The following changes are made:
> 
>  * use float instead of double
>  * use strtok_r instead of av_strtok
>  * remove asserts
>  * use AVFrame instead of manually allocating memory
> ---

Note for future reference: Most of these comments do not belong in the
log message itself.  You can pass --annotate to git-send-email and write
such comments below the --- so that they appear in the email, but not in
the log message.

> --- a/doc/filters.texi
> +++ b/doc/filters.texi
> @@ -467,6 +467,80 @@ To fix a 5.1 WAV improperly encoded in AAC's native 
> channel order
>  
> +@item attacks
> +@item decays
> +Set list of times in seconds for each channel over which the instantaneous 
> level
> +of the input signal is averaged to determine its volume. @var{attacks} 
> refers to
> +increase of volume and @var{decays} refers to decrease of volume. For most
> +situations, the attack time (response to the audio getting louder) should be
> +shorter than the decay time because the human ear is more sensitive to sudden
> +loud audio than sudden soft audio. Typical value for attack is 0.3 seconds 
> and
> +for decay 0.8 seconds.

In the last sentence you suddenly write attack/decay instead of attackS/decayS.

Also, either write "A typical value" or "Typical values".

> +@item points
> +Set list of points for transfer function, specified in dB relative to maximum
> +possible signal amplitude.

for the, to the

> Each key points list need to be defined using the following syntax:

needS

> +The input values must be in strictly increasing order but the transfer 
> function
> +does not have to be monotonically rising. The point @code{0/0} is assumed but
> +may be overridden (by @code{0/out-dBn}). Typical values for the transfer
> +function are @code{-70/-70 -60/-20}.
> +
> +@item soft-knee
> +Set amount for which the points at where adjacent line segments on the 
> transfer
> +function meet will be rounded.

This sentence makes me stumble, maybe

  The points at where adjacent line segments on the transfer function
  meet will be rounded by this amount.

> Defaults is 0.01.

Default_

> +@item gain
> +Set additional gain in dB to be applied at all points on the transfer 
> function
> +and allows easy adjustment of the overall gain. Default is 0.

I'd split the sentence, as I stumbled again.  Maybe

  Set additional gain in dB to be applied at all points on the transfer
  function. This allows easy adjustment of the overall gain. Default is 0.

> +@item delay
> +Set delay in seconds. Default is 0. The input audio is analysed immediately,

analyZed

The rest of the documentation is written in American English.

> --- a/libavfilter/Makefile
> +++ b/libavfilter/Makefile
> @@ -37,6 +37,7 @@ OBJS-$(CONFIG_CHANNELSPLIT_FILTER)           += 
> af_channelsplit.o
>  OBJS-$(CONFIG_JOIN_FILTER)                   += af_join.o
>  OBJS-$(CONFIG_RESAMPLE_FILTER)               += af_resample.o
>  OBJS-$(CONFIG_VOLUME_FILTER)                 += af_volume.o
> +OBJS-$(CONFIG_COMPAND_FILTER)                += af_compand.o

This list is sorted alphabetically, please keep it sorted.

> --- /dev/null
> +++ b/libavfilter/af_compand.c
> @@ -0,0 +1,548 @@
> + * You should have received a copy of the GNU Lesser General Public
> + * License along with Libav; if not, write to the Free Software
> + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 
> USA
> + *
> + */

nit: stray empty line

> +static const AVOption compand_options[] = {
> +    { "attacks", "set time over which increase of volume is determined", 
> OFFSET(attacks), AV_OPT_TYPE_STRING, {.str=NULL}, 0, 0, A },
> +    { "decays", "set time over which decrease of volume is determined", 
> OFFSET(decays), AV_OPT_TYPE_STRING, {.str=NULL}, 0, 0, A },
> +    { "points", "set points of transfer function", OFFSET(points), 
> AV_OPT_TYPE_STRING, {.str=NULL}, 0, 0, A },
> +    { "soft-knee", "set soft-knee", OFFSET(curve_dB), AV_OPT_TYPE_FLOAT, 
> {.dbl=0.01}, 0.01, 900, A },
> +    { "gain", "set output gain", OFFSET(gain_dB), AV_OPT_TYPE_FLOAT, 
> {.dbl=0}, -900, 900, A },
> +    { "volume", "set initial volume", OFFSET(initial_volume), 
> AV_OPT_TYPE_FLOAT, {.dbl=0}, -900, 0, A },
> +    { "delay", "set delay for samples before sending them to volume 
> adjuster", OFFSET(delay), AV_OPT_TYPE_FLOAT, {.dbl=0}, 0, 20, A },
> +    { NULL }
> +};

spaces inside {}, spaces around =

> +                    s->pts += av_rescale_q(nb_samples - i, (AVRational){1, 
> inlink->sample_rate}, inlink->time_base);

> +    s->pts += av_rescale_q(frame->nb_samples, (AVRational){1, 
> outlink->sample_rate}, outlink->time_base);

same

> +        in1 = cx - L(3).x;
> +        out1 = cy - L(3).y;
> +        in2 = L(2).x - L(3).x;
> +        out2 = L(2).y - L(3).y;

align the =

> +        L(3).a = (out2 / in2 - out1 / in1) / (in2-in1);

spaces around -

> +    s->delay_frame->format = outlink->format;
> +    s->delay_frame->nb_samples = s->delay_samples;
> +    s->delay_frame->channel_layout = outlink->channel_layout;

align the =

Diego
_______________________________________________
libav-devel mailing list
libav-devel@libav.org
https://lists.libav.org/mailman/listinfo/libav-devel

Reply via email to