Re: [PATCH 4/6] LZ4: Fix the row alignment when it is not on a 32bit boundary

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Wed, Jan 28, 2015 at 11:49:47AM +0100, Javier Celaya wrote:
> Fix the row alignment for 16/24 bpp images when it is not in a 32bit
> boundary. This is needed for 16bpp images when the width is an odd
> number, and for the future support of 24bpp images.
> ---
> @@ -620,6 +623,21 @@ static pixman_image_t *canvas_get_lz4(CanvasBase *canvas, SpiceImage *image, int
>          data += enc_size;
>      } while (data < data_end);
>  
> +    if (stride_abs > stride_encoded) {
> +        // Fix the row alignment
> +        int row;
> +        uint32_t *dest_aligned, *dest_misaligned;
> +        dest = (uint8_t *)pixman_image_get_data(surface);
> +        if (!top_down) {
> +            dest -= (stride_abs * (height - 1));
> +        }
> +        for (row = height - 1; row > 0; --row) {
> +            dest_aligned = (uint32_t *)(dest + stride_abs*row);
> +            dest_misaligned = (uint32_t*)(dest + stride_encoded*row);
> +            memmove(dest_aligned, dest_misaligned, stride_encoded);
> +        }
> +    }
> +

Looking at common/canvas_utils.c:surface_create, we don't seem to align
rows when top_down is TRUE, it seems this code will need to be more
careful in this case :(

Christophe

Attachment: pgpZT27EkzF6Q.pgp
Description: PGP signature

_______________________________________________
Spice-devel mailing list
Spice-devel@xxxxxxxxxxxxxxxxxxxxx
http://lists.freedesktop.org/mailman/listinfo/spice-devel

[Index of Archives]     [Linux ARM Kernel]     [Linux ARM]     [Linux Omap]     [Fedora ARM]     [IETF Annouce]     [Security]     [Bugtraq]     [Linux]     [Linux OMAP]     [Linux MIPS]     [ECOS]     [Asterisk Internet PBX]     [Linux API]     [Monitors]