On 07/11/2013 07:07 AM, Kostya Shishkov wrote:
> ---
> I don't have samples for it so it's rather theoretical.
> ---
>  libavcodec/imc.c |  151 
> ++++++++++++++++++++++++++++++++++++------------------
>  1 file changed, 102 insertions(+), 49 deletions(-)
> 

This

> +        for (i = 0; i < BANDS; i++) {
> +            chctx->sumLenArr[i]   = 0;
> +            chctx->skipFlagRaw[i] = 0;
> +            for (j = band_tab[i]; j < band_tab[i + 1]; j++)
> +                chctx->sumLenArr[i] += chctx->CWlengthT[j];
> +            if (chctx->bandFlagsBuf[i])
> +                if ((((band_tab[i + 1] - band_tab[i]) * 1.5) > 
> chctx->sumLenArr[i]) && (chctx->sumLenArr[i] > 0))
> +                    chctx->skipFlagRaw[i] = 1;
> +        }
>  
> -    imc_get_skip_coeff(q, chctx);
> +        imc_get_skip_coeff(q, chctx);
>  
> -    for (i = 0; i < BANDS; i++) {
> -        chctx->flcoeffs6[i] = chctx->flcoeffs1[i];
> -        /* band has flag set and at least one coded coefficient */
> -        if (chctx->bandFlagsBuf[i] && (band_tab[i + 1] - band_tab[i]) != 
> chctx->skipFlagCount[i]) {
> -            chctx->flcoeffs6[i] *= q->sqrt_tab[ band_tab[i + 1] - 
> band_tab[i]] /
> -                                   q->sqrt_tab[(band_tab[i + 1] - 
> band_tab[i] - chctx->skipFlagCount[i])];
> +        for (i = 0; i < BANDS; i++) {
> +            chctx->flcoeffs6[i] = chctx->flcoeffs1[i];
> +            /* band has flag set and at least one coded coefficient */
> +            if (chctx->bandFlagsBuf[i] && (band_tab[i + 1] - band_tab[i]) != 
> chctx->skipFlagCount[i]) {
> +                chctx->flcoeffs6[i] *= q->sqrt_tab[ band_tab[i + 1] - 
> band_tab[i]] /
> +                                       q->sqrt_tab[(band_tab[i + 1] - 
> band_tab[i] - chctx->skipFlagCount[i])];
> +            }
>          }
> -    }
>  
> -    /* calculate bits left, bits needed and adjust bit allocation */
> -    bits = summer = 0;
> +        /* calculate bits left, bits needed and adjust bit allocation */
> +        bits = summer = 0;
>  
> -    for (i = 0; i < BANDS; i++) {
> -        if (chctx->bandFlagsBuf[i]) {
> -            for (j = band_tab[i]; j < band_tab[i + 1]; j++) {
> -                if (chctx->skipFlags[j]) {
> -                    summer += chctx->CWlengthT[j];
> -                    chctx->CWlengthT[j] = 0;
> +        for (i = 0; i < BANDS; i++) {
> +            if (chctx->bandFlagsBuf[i]) {
> +                for (j = band_tab[i]; j < band_tab[i + 1]; j++) {
> +                    if (chctx->skipFlags[j]) {
> +                        summer += chctx->CWlengthT[j];
> +                        chctx->CWlengthT[j] = 0;
> +                    }
>                  }
> +                bits   += chctx->skipFlagBits[i];
> +                summer -= chctx->skipFlagBits[i];
>              }
> -            bits   += chctx->skipFlagBits[i];
> -            summer -= chctx->skipFlagBits[i];
>          }
> +        imc_adjust_bit_allocation(q, chctx, summer);

might be moved in a separate function. Beside that doesn't look wrong,
assuming your theory matches reality =)

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

Reply via email to