[FFmpeg-devel] [PATCH 6/7] utvideoenc: align mangled buffer starts.
Derek Buitenhuis
derek.buitenhuis at gmail.com
Wed Aug 22 17:12:11 CEST 2012
On 22/08/2012 10:26 AM, Michael Niedermayer wrote:
> This is essential for fast SIMD accesses.
> The same should be done with the predict output.
>
> Signed-off-by: Michael Niedermayer <michaelni at gmx.at>
> ---
> libavcodec/utvideo.h | 1 +
> libavcodec/utvideoenc.c | 14 ++++++++------
> 2 files changed, 9 insertions(+), 6 deletions(-)
Is this a preemptive measure for future SIMD, or does it have direct
benefits in this patchset? Just curious, as I'm a n00b at SIMD.
> diff --git a/libavcodec/utvideo.h b/libavcodec/utvideo.h
> index 2441375..135e927 100644
> --- a/libavcodec/utvideo.h
> +++ b/libavcodec/utvideo.h
> @@ -75,6 +75,7 @@ typedef struct UtvideoContext {
> int interlaced;
> int frame_pred;
>
> + int slice_stride;
> uint8_t *slice_bits, *slice_buffer[4];
> int slice_bits_size;
Please align with the rest of the declarations here.
> for(i=0; i<c->planes; i++) {
> - c->slice_buffer[i] = av_malloc(avctx->width * (avctx->height+1) +
> + c->slice_stride = FFALIGN(avctx->width, 32);
> + c->slice_buffer[i] = av_malloc(c->slice_stride * (avctx->height+2) +
> FF_INPUT_BUFFER_PADDING_SIZE);
(avctx->height+2) -> (avctx->height + 2)
> -static void mangle_rgb_planes(uint8_t *dst[4], uint8_t *src, int step, int stride, int width,
> +static void mangle_rgb_planes(uint8_t *dst[4], int dst_stride, uint8_t *src, int step, int stride, int width,
> int height)
80 cols.
> int i, j;
> - int k=width;
> + int k = 2*dst_stride;
See my comment from the previous patch. Also, 2*dst_stride -> 2 * dst_stride.
> - mangle_rgb_planes(c->slice_buffer, pic->data[0], c->planes, pic->linesize[0], width,
> + mangle_rgb_planes(c->slice_buffer, c->slice_stride, pic->data[0], c->planes, pic->linesize[0], width,
> height);
80 cols.
> - ret = encode_plane(avctx, c->slice_buffer[i] + width,
> - c->slice_buffer[i], width,
> + ret = encode_plane(avctx, c->slice_buffer[i] + 2*c->slice_stride,
> + c->slice_buffer[i], c->slice_stride,
> width, height, &pb);
2*c->slice_stride -> 2 * c->slice_stride.
- Derek
More information about the ffmpeg-devel
mailing list