On 2014-02-14 16:03:14 +0000, Christophe Gisquet wrote:
> This seems to simplify noticeably the addressing. Timings before/after
> for respectively win32 and win64 are 260/222 and 242/231.
> ---
> libavcodec/dcadsp.c | 13 ++++++++-----
> 1 file changed, 8 insertions(+), 5 deletions(-)
>
> diff --git a/libavcodec/dcadsp.c b/libavcodec/dcadsp.c
> index 10fadd6..f89dfaa 100644
> --- a/libavcodec/dcadsp.c
> +++ b/libavcodec/dcadsp.c
> @@ -30,14 +30,17 @@ static void decode_hf_c(float dst[DCA_SUBBANDS][8],
> int32_t scale[DCA_SUBBANDS][2],
> intptr_t start, intptr_t end)
> {
> - int l;
> + int i, l;
> + const int8_t *pvq = hf_vq[0] + vq_offset;
> for (l = start; l < end; l++) {
> /* 1 vector -> 32 samples but we only need the 8 samples
> * for this subsubframe. */
> - int i, hfvq = vq_num[l];
> - float fscale = scale[l][0] / 16.0;
> - for (i = 0; i < 8; i++)
> - dst[l][i] = hf_vq[hfvq][vq_offset + i] * fscale;
> + const int8_t *ptr = pvq + vq_num[l]*sizeof(hf_vq[0]);
have you tried const int8_t *ptr = &hf_vq[l][vq_offset]; ?
I think we have at least a strong preference for not relying on
the undefined memory layout of multi dimensional arrays in C.
> + float fscale = scale[l][0] * (1 / 16.0);
> + for (i = 0; i < 8; i++) {
> + /* hf_vq[hfvq][vq_offset + i] * fscale */
without the overly complex ptr arithmetic the comment can imho go
> + dst[l][i] = ptr[i] * fscale;
> + }
Janne
_______________________________________________
libav-devel mailing list
[email protected]
https://lists.libav.org/mailman/listinfo/libav-devel