summaryrefslogtreecommitdiffstats
path: root/server/jpeg_encoder.c
Commit message (Collapse)AuthorAgeFilesLines
* mjpeg and jpeg encoder: fix alignment warningsVictor Toso2015-08-201-8/+8
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | As the input line could be uint8_t*, uint16_t* or uint32_t*, changing the default from uint8_t* to void* seems the correct choice to deal with upcasting warnings. Regarding chunks->data allocation, I quote Frediano explantion: "Lines came from spice_bitmap_get_line. This function assume that bitmap data is split among chunks each containing some lines (always full lines). If chunk->data is allocated using malloc or similar SHOULD (not 100% sure) be 4 bytes aligned so in our cases (8, 16, 24 or 32 bit images) should be aligned enough. All the casts unfortunately came from the fact we compute based on pixel bytes to make it generic so we use uint8_t*." and "Looking at code looks like these chunks came from the virtual machine. So the question is... why should the virtual machine give use some not-pixel align data? I would put a large comment to state that we assume VM send aligned data, would be stupid for the VM to not align it!" clang output: jpeg_encoder.c:109:26: error: cast from 'uint8_t *' (aka 'unsigned char *') to 'uint16_t *' (aka 'unsigned short *') increases required alignment from 1 to 2 [-Werror,-Wcast-align] uint16_t *src_line = (uint16_t *)line; ^~~~~~~~~~~~~~~~ jpeg_encoder.c:144:26: error: cast from 'uint8_t *' (aka 'unsigned char *') to 'uint32_t *' (aka 'unsigned int *') increases required alignment from 1 to 4 [-Werror,-Wcast-align] uint32_t *src_line = (uint32_t *)line; ^~~~~~~~~~~~~~~~ mjpeg_encoder.c:260:23: error: cast from 'uint8_t *' (aka 'unsigned char *') to 'uint16_t *' (aka 'unsigned short *') increases required alignment from 1 to 2 [-Werror,-Wcast-align] uint16_t pixel = *(uint16_t *)src; ^~~~~~~~~~~~~~~
* Use the spice-common logging functionsMarc-André Lureau2012-03-251-7/+7
| | | | | It will abort by default for critical level messages. That behaviour can be tuned at runtime.
* Remove trailing whitespace from end of linesDaniel P. Berrange2012-01-131-15/+15
|
* Death to all TABsDaniel P. Berrange2012-01-131-1/+1
| | | | | | Source files should all use spaces instead of tabs for indentation. Update the few files not already in compliance
* fix leak in do_jpeg_encodeChristophe Fergeau2011-08-251-0/+4
| | | | | | | | Issue found by the Coverity scanner. HDG: Fixup don't free RGB24_line if it was not allocated by do_jpeg_encode Signed-off-by: Hans de Goede <hdegoede@redhat.com>
* add #include <config.h> to all source filesChristophe Fergeau2011-05-031-0/+3
| | | | | | | | When using config.h, it must be the very first include in all source files since it contains #define that may change the compilation process (eg libc structure layout changes when it's used to enable large file support on 32 bit x86 archs). This commit adds it at the beginning of all .c and .cpp files
* client/server: warning fixes (gcc 4.6.0)Alon Levy2011-01-251-2/+1
| | | | | gcc 4.6.0 added "[-Werror=unused-but-set-variable]", this and the next few fixes tend to that. Mostly harmless.
* JPEG support: introducing jpeg encoding for spice bitmapsYonit Halperin2010-06-091-0/+242