This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

AM625: decompress error in uboot splash

Part Number: AM625

Hi,

An error is reported when loading the splash 
Error: inflate() returned -5

This error is reported when the file is decompressed. The inflate() return a Z_BUF_ERROR, caused by insufficient buffer.
The display image specified in uboot is logo_1024x600.bmp.gz, and the file size is as follows

# ls -alh
drwxr-xr-x    2 root     root        4.0K Jan  1  1970 .
drwxr-xr-x   24 root     root        1.0K Jun  6 17:05 ..
-rwxr-xr-x    1 root     root      450.1K Jun 28 14:25 logo_512x300.bmp
-rwxr-xr-x    1 root     root       13.5K Jun 28 14:22 logo_512x300.bmp.gz
-rwxr-xr-x    1 root     root        1.8M Jul 18  2023 logo_1024x600.bmp
-rwxr-xr-x    1 root     root      203.6K Jun 27 10:02 logo_1024x600.bmp.gz
-rwxr-xr-x    1 root     root       12.0K Jun 20 15:37 ti_logo_414x97_32bpp.bmp.gz
-rwxr-xr-x    1 root     root      282.9K Jun 28 16:27 tiboot3.bin
-rwxr-xr-x    1 root     root        1.0M Jun 28 16:27 tispl.bin
-rwxr-xr-x    1 root     root      921.6K Jun 28 16:27 u-boot.img

Except for logo_1024x600.bmp.gz, other files can be loaded and displayed through the bmp command.

=> fatload mmc 1 $loadaddr logo_512x300.bmp.gz
13799 bytes read in 20 ms (672.9 KiB/s)
=> bmp display $loadaddr m m
=> fatload mmc 1 $loadaddr logo_1024x600.bmp
1843254 bytes read in 317 ms (5.5 MiB/s)
=> bmp display $loadaddr m m
=> fatload mmc 1 $loadaddr logo_1024x600.bmp.gz
208537 bytes read in 52 ms (3.8 MiB/s)
=> bmp display $loadaddr m m
Error: inflate() returned -5
There is no valid bmp file at the given address
=> 

For this situation, how to increase the buffer to support large compressed files? 

Regards,

Stephen

  • Hi,

    Sorry for the delay, will respond next work day.

    ~ Judith

  • Hi,

    9.0 SDK supports frame-buffer of size 1920x1200, so it seems like your image should work.

    I see the following error: "There is no valid bmp file at the given address"

    Are you sure "logo_1024x600.bmp.gz" is in the fat partition of SD card?

    ~ Judith

  • Hi Judith,

    The file is locate in the fat partition, same as file logo_512x300.bmp.gz and logo_1024x600.bmp(can be displayed normally).

     I think the " no valid bmp" error is caused by bmp not being decompressed, that is, the error in inflate()

  • Hi Stephen,

    Will look into this and respond soon.

    ~ Judith

  • Hi  Judith,

    There is a limit on the size of compressed files VIDEO_LOGO_MAX_SIZE

    The max uncompressed size is 0x100000=1Mbit

    Increasing the settings can solve the problem.

    config VIDEO_LOGO_MAX_SIZE
    hex "Maximum size of the bitmap logo in bytes"
    default 0x100000
    help
    Sets the maximum uncompressed size of the logo. This is needed when
    decompressing a BMP file using the gzip algorithm, since it cannot
    read the size from the bitmap header.

    	/*
    	 * Decompress bmp image
    	 */
    	len = CONFIG_VAL(VIDEO_LOGO_MAX_SIZE);
    	/* allocate extra 3 bytes for 32-bit-aligned-address + 2 alignment */
    	dst = malloc(CONFIG_VAL(VIDEO_LOGO_MAX_SIZE) + 3);
    	if (!dst) {
    		puts("Error: malloc in gunzip failed!\n");
    		return NULL;
    	}
    
    	/* align to 32-bit-aligned-address + 2 */
    	bmp = dst + 2;
    
    	if (gunzip(bmp, CONFIG_VAL(VIDEO_LOGO_MAX_SIZE), map_sysmem(addr, 0),
    		   &len)) {
    		free(dst);
    		return NULL;
    	}