[FFmpeg-devel] [PATCH] Prores: Move large on-stack arrays into context instead.
Jonne Ahner
jonne.ahner at gmail.com
Tue Sep 20 00:18:23 CEST 2011
Its late and Im a master at being wrong. :)
Is it still thread safe, I get the feeling that that execute2 and the
threads thing will spawn threads?
On Mon, Sep 19, 2011 at 11:05 PM, Reimar Döffinger <Reimar.Doeffinger at gmx.de
> wrote:
> The quantization matrices used in related code are also there,
> so cache effects should not be (too) negative - not benchmarked though.
>
> Signed-off-by: Reimar Döffinger <Reimar.Doeffinger at gmx.de>
> ---
> libavcodec/proresdec.c | 21 +++++++++++----------
> 1 files changed, 11 insertions(+), 10 deletions(-)
>
> diff --git a/libavcodec/proresdec.c b/libavcodec/proresdec.c
> index c56b258..0320f8a 100644
> --- a/libavcodec/proresdec.c
> +++ b/libavcodec/proresdec.c
> @@ -42,6 +42,7 @@ typedef struct {
> AVFrame frame;
> DSPContext dsp;
> int frame_type; ///< 0 = progressive, 1 = tff, 2 = bff
> + DECLARE_ALIGNED(16, DCTELEM, blocks)[8*4*64];
> uint8_t qmat_luma[64];
> uint8_t qmat_chroma[64];
> SliceContext *slices;
> @@ -397,19 +398,19 @@ static void decode_slice_luma(AVCodecContext *avctx,
> SliceContext *slice,
> const int *qmat)
> {
> ProresContext *ctx = avctx->priv_data;
> - DECLARE_ALIGNED(16, DCTELEM, blocks)[8*4*64], *block;
> + DCTELEM *block;
> GetBitContext gb;
> int i, blocks_per_slice = slice->mb_count<<2;
>
> for (i = 0; i < blocks_per_slice; i++)
> - ctx->dsp.clear_block(blocks+(i<<6));
> + ctx->dsp.clear_block(ctx->blocks+(i<<6));
>
> init_get_bits(&gb, buf, buf_size << 3);
>
> - decode_dc_coeffs(&gb, blocks, blocks_per_slice, qmat);
> - decode_ac_coeffs(avctx, &gb, blocks, blocks_per_slice, qmat);
> + decode_dc_coeffs(&gb, ctx->blocks, blocks_per_slice, qmat);
> + decode_ac_coeffs(avctx, &gb, ctx->blocks, blocks_per_slice, qmat);
>
> - block = blocks;
> + block = ctx->blocks;
> for (i = 0; i < slice->mb_count; i++) {
> ctx->idct_put(block+(0<<6), dst, dst_stride);
> ctx->idct_put(block+(1<<6), dst+16, dst_stride);
> @@ -426,19 +427,19 @@ static void decode_slice_chroma(AVCodecContext
> *avctx, SliceContext *slice,
> const int *qmat)
> {
> ProresContext *ctx = avctx->priv_data;
> - DECLARE_ALIGNED(16, DCTELEM, blocks)[8*4*64], *block;
> + DCTELEM *block;
> GetBitContext gb;
> int i, blocks_per_slice = slice->mb_count*2;
>
> for (i = 0; i < blocks_per_slice; i++)
> - ctx->dsp.clear_block(blocks+(i<<6));
> + ctx->dsp.clear_block(ctx->blocks+(i<<6));
>
> init_get_bits(&gb, buf, buf_size << 3);
>
> - decode_dc_coeffs(&gb, blocks, blocks_per_slice, qmat);
> - decode_ac_coeffs(avctx, &gb, blocks, blocks_per_slice, qmat);
> + decode_dc_coeffs(&gb, ctx->blocks, blocks_per_slice, qmat);
> + decode_ac_coeffs(avctx, &gb, ctx->blocks, blocks_per_slice, qmat);
>
> - block = blocks;
> + block = ctx->blocks;
> for (i = 0; i < slice->mb_count; i++) {
> ctx->idct_put(block+(0<<6), dst, dst_stride);
> ctx->idct_put(block+(1<<6), dst+8*dst_stride, dst_stride);
> --
> 1.7.6.3
>
> _______________________________________________
> ffmpeg-devel mailing list
> ffmpeg-devel at ffmpeg.org
> http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
>
More information about the ffmpeg-devel
mailing list