@@ -99,18 +99,18 @@ static void dump_hex(const rt_uint8_t *ptr, rt_size_t buflen)
9999#define RANGE_LIMIT (x ) (x > 255 ? 255 : (x < 0 ? 0 : x))
100100
101101/*
102- * YUV422打包数据,UYVY,转换为RGB565,
102+ * YUV422打包数据,UYVY,转换为RGB565,
103103* inBuf -- YUV data
104104* outBuf -- RGB565 data
105105* imgWidth,imgHeight -- image width and height
106- * cvtMethod -- 无效参数
106+ * cvtMethod -- 无效参数
107107*/
108108int convert_uyvy_to_rgb (unsigned char * inBuf , unsigned char * outBuf , int imgWidth , int imgHeight )
109109{
110- int rows ,cols ; /* 行列标志 */
111- int y , u , v , r , g , b ; /* yuv rgb 相关分量 */
112- unsigned char * YUVdata , * RGBdata ; /* YUV和RGB数据指针 */
113- int Ypos , Upos , Vpos ; /* Y U V在数据缓存中的偏移 */
110+ int rows ,cols ; /* 行列标志 */
111+ int y , u , v , r , g , b ; /* yuv rgb 相关分量 */
112+ unsigned char * YUVdata , * RGBdata ; /* YUV和RGB数据指针 */
113+ int Ypos , Upos , Vpos ; /* Y U V在数据缓存中的偏移 */
114114 unsigned int i = 0 ;
115115
116116 YUVdata = inBuf ;
@@ -133,12 +133,12 @@ int convert_uyvy_to_rgb(unsigned char *inBuf, unsigned char *outBuf, int imgWidt
133133 Vpos = Ypos + 1 ;
134134#endif
135135
136- /* 每个像素两个字节 */
136+ /* 每个像素两个字节 */
137137 for (rows = 0 ; rows < imgHeight ; rows ++ )
138138 {
139139 for (cols = 0 ; cols < imgWidth ; cols ++ )
140140 {
141- /* 矩阵推到,百度 */
141+ /* 矩阵推到,百度 */
142142 y = YUVdata [Ypos ];
143143 u = YUVdata [Upos ] - 128 ;
144144 v = YUVdata [Vpos ] - 128 ;
@@ -151,15 +151,15 @@ int convert_uyvy_to_rgb(unsigned char *inBuf, unsigned char *outBuf, int imgWidt
151151 g = g > 255 ?255 :(g < 0 ?0 :g );
152152 b = b > 255 ?255 :(b < 0 ?0 :b );
153153
154- /* 从低到高r g b */
155- * (RGBdata ++ ) = (((g & 0x1c ) << 3 ) | (b >> 3 )); /* g低5位,b高5位 */
156- * (RGBdata ++ ) = ((r & 0xf8 ) | (g >> 5 )); /* r高5位,g高3位 */
154+ /* 从低到高r g b */
155+ * (RGBdata ++ ) = (((g & 0x1c ) << 3 ) | (b >> 3 )); /* g低5位,b高5位 */
156+ * (RGBdata ++ ) = ((r & 0xf8 ) | (g >> 5 )); /* r高5位,g高3位 */
157157
158- /* 两个字节数据中包含一个Y */
158+ /* 两个字节数据中包含一个Y */
159159 Ypos += 2 ;
160160 //Ypos++;
161161 i ++ ;
162- /* 每两个Y更新一次UV */
162+ /* 每两个Y更新一次UV */
163163 if (!(i & 0x01 ))
164164 {
165165 Upos = Ypos - 1 ;
@@ -180,7 +180,7 @@ static void rgb565_to_rgb888(rt_uint16_t *rgb565Color, rt_uint8_t *rgb888Color,
180180 for (i = 0 , n = 0 ; i < size ; i ++ , n += 3 )
181181 {
182182 color = rgb565Color [i ];
183- // 获取RGB单色,并填充低位
183+ // 获取RGB单色,并填充低位
184184 rgb888Color [n ] = ((color & RGB565_RED ) >> 11 ) <<3 ;
185185 rgb888Color [n + 1 ] = ((color & RGB565_GREEN ) >> 5 ) <<2 ;
186186 rgb888Color [n + 2 ] = (color & RGB565_BLUE ) <<3 ;
@@ -323,8 +323,8 @@ static rt_err_t camera_inf_cfg_gc0328c_fps(rt_uint8_t fps_type)
323323void gc0328c_rgb565_mode (void )
324324{
325325 write_reg (i2c_bus , 0xfe , 0x00 );
326- write_reg (i2c_bus , 0x49 , 0x23 ); //切换大小端
327- write_reg (i2c_bus , 0x44 , 0x26 ); //切换到RGB565输出
326+ write_reg (i2c_bus , 0x49 , 0x23 ); //切换大小端
327+ write_reg (i2c_bus , 0x44 , 0x26 ); //切换到RGB565输出
328328}
329329
330330void camera_dma_data_process (void )
0 commit comments