rgb565 image transfer rgb332

tags: RTOS  RGB565  RGB332

I was doing in front of a RTOS SCM system, LCD default image format is RGB565, but we are more interface, multi-picture resources, because the system only flash 4M

Picture too much out of the system results in a compile program flash.bin exceed 4M, is not conducive to expansion.

Back to think of compressed images, our image is an array of resources RGB565, and a 320 * 320 * 320 * 320 images have 2 bytes, nearly 200KB.

Relatively large.

Later compressed into rgb332, one pixel is one byte. You can save half the space.

Example code:

int image_convert_rgb565_to_rgb332(uint8_t *rgb565_src, uint8_t *rgb332_dst,uint32_t src_w,uint32_t src_h)
{
    uint32_t i,j;
    uint16_t *psrc_temp;
    uint8_t *pdst_temp;
    if (!rgb565_src || !rgb332_dst || src_w <= 0 || src_h <= 0) {
        LOG_I(x_screen,"image_convert_rgb565_to_rgb332 parameter error\n");
        return -1; 
    }   
    psrc_temp = (uint16_t *)rgb565_src;
    pdst_temp = (uint8_t *)rgb332_dst;
    for (i = 0; i < src_h; i++) {
        for (j = 0; j < src_w; j++) {
            *pdst_temp = ((*psrc_temp >> 13) << 5) //r 
                | ((*psrc_temp >> 8 & 0x07) << 2) //g 
                | (*psrc_temp >> 3 & 0x03); //b 
            pdst_temp++;
            psrc_temp++;
        }
    }   
    return 0;
}

 

Intelligent Recommendation

RGB565 to BMP format

RGB565 to BMP format...

Double byte to RGB565 to RGB888

//A game picture resource is stored in a double-byte RGB565 compressed form, //At the beginning of parsing the file, I thought that the picture display was also rgb565, and the result color was always...

Bmp to rgb565 is displayed in framebuffer

Requirement: Customize the display picture in the kernel Solution: I found a lot of methods on the Internet, and they all replaced them. That would be very limited and troublesome. So after research, ...

More Recommendation

RGB888 Convert to RGB565 format

24bit RGB888:R7 R6 R5 R4 R3 R2 R1 R0 G7 G6 G5 G4 G3 G2 G1 G0 B7 B6 B5 B4 B3 B2 B1 B0 16bit RGB656:R4 R3 R2 R1 R0 G5 G4 G3 G2 G1 G0 B4 B3 B2 B1 B0 Add a While, make onesmall tools:...

RGB565 YUV conversion program

Since the RGB565 is 16-bit data, each pixel point occupies two bytes size, so when using the first function, it is necessary to send the current address and the next bit of the image pixel to the func...

YUV422 turn RGB565

Approximate process YUV RGB565...

4 RGB565 LCD

Summarize: : 1 + LCD + , , . , modelsim MCU GUI, verilog LCD, RGB LCD 、 、 。 verilog 、 、 C 、 LCD , STM32 LTDC 、 ( ), STM32 , 。          , RTL 。 Figure 245 , LTDC...

C rgb565 ride RGB888

bmp.h main.cpp...

Copyright  DMCA © 2018-2026 - All Rights Reserved - www.programmersought.com  User Notice

Top