Justin Ruggles <[email protected]> writes:

> This is about 200% faster for in-decoder downmixing of 5.0 and 5.1 content.
> ---
>  libavcodec/ac3dsp.c |   39 ++++++++++++++++++++++++++++++++++++++-
>  1 files changed, 38 insertions(+), 1 deletions(-)
>
> diff --git a/libavcodec/ac3dsp.c b/libavcodec/ac3dsp.c
> index 6a30561..5b7e2e7 100644
> --- a/libavcodec/ac3dsp.c
> +++ b/libavcodec/ac3dsp.c
> @@ -174,9 +174,46 @@ static void ac3_extract_exponents_c(uint8_t *exp, 
> int32_t *coef, int nb_coefs)
>  static void ac3_downmix_c(float **samples, float **matrix,
>                            int out_ch, int in_ch, int len)
>  {
> +    int **matrix_cmp = (int **)matrix;
>      int i, j;
>      float v0, v1;
> -    if (out_ch == 2) {
> +
> +    if (in_ch == 5 && out_ch == 2 &&
> +        !(matrix_cmp[1][0] | matrix_cmp[0][2]   |
> +          matrix_cmp[1][3] | matrix_cmp[0][4]   |
> +         (matrix_cmp[0][1] ^ matrix_cmp[1][1]) |
> +         (matrix_cmp[0][0] ^ matrix_cmp[1][2]))) {

Reading floats as ints like that is not valid C.  Use av_float2int() instead.

-- 
Måns Rullgård
[email protected]
_______________________________________________
libav-devel mailing list
[email protected]
https://lists.libav.org/mailman/listinfo/libav-devel

Reply via email to