removed rgb2rbg

This commit is contained in:
Miguel Fuertes committed 2025-10-15 13:21:30 +02:00
1 parent 5650d675aa
commit e85c331c7f
4 files changed
+7 -89

No files matched your search

-42
View File
@@ -1,42 +0,0 @@
include $(TOPDIR)/rules.mk
PKG_NAME:=rgb2rbg
PKG_RELEASE:=1
include $(INCLUDE_DIR)/package.mk
define Package/rgb2rbg
SECTION:=utils
CATEGORY:=Utilities
TITLE:=RGB565 to RBG converter
endef
define Package/rgb2rbg/description
Converts RGB565 to RBG (swaps Green and Blue channels).
endef
define Build/Prepare
mkdir -p $(PKG_BUILD_DIR)
$(CP) ./src/* $(PKG_BUILD_DIR)/
endef
define Build/Configure
endef
define Build/Compile
$(TARGET_CC) $(TARGET_CFLAGS) $(TARGET_LDFLAGS) \
-O3 -fomit-frame-pointer -funroll-loops \
-o $(PKG_BUILD_DIR)/rgb2rbg \
$(PKG_BUILD_DIR)/rgb2rbg.c
# $(TARGET_STRIP) $(PKG_BUILD_DIR)/rgb2rbg
endef
define Build/Install
endef
define Package/rgb2rbg/install
$(INSTALL_DIR) $(1)/usr/bin
$(INSTALL_BIN) $(PKG_BUILD_DIR)/rgb2rbg $(1)/usr/bin/
endef
$(eval $(call BuildPackage,rgb2rbg))
-41
View File
@@ -1,41 +0,0 @@
/*
* rgb2rbg.c - RGB565 to RBG565 converter (CORRECTO)
* Swaps Green and Blue channels with proper bit conversion
*/
#include <stdio.h>
#include <stdint.h>
#define BUFFER_SIZE 8192
static inline uint16_t rgb_to_rbg(uint16_t pixel) {
// Extraer componentes RGB565
uint16_t r = (pixel >> 11) & 0x1F; // Rojo: 5 bits
uint16_t g = (pixel >> 5) & 0x3F; // Verde: 6 bits
uint16_t b = pixel & 0x1F; // Azul: 5 bits
// Convertir para RBG565:
// - Rojo mantiene 5 bits
// - Verde (6 bits) va a posición de Azul (que también usa 6 bits en el panel)
// - Azul (5 bits) va a posición de Verde, expandir a 6 bits
uint16_t b_expanded = (b << 1) | (b >> 4); // Expandir B de 5 a 6 bits
// RBG565: RRRRR GGGGGG BBBBB donde G y B están swapeados
// Pero en realidad el panel espera: RRRRR BBBBBB GGGGG (6 bits para ambos)
return (r << 11) | (g << 5) | b_expanded;
}
int main(void) {
uint16_t buffer[BUFFER_SIZE];
size_t n;
while ((n = fread(buffer, sizeof(uint16_t), BUFFER_SIZE, stdin)) > 0) {
for (size_t i = 0; i < n; i++) {
buffer[i] = rgb_to_rbg(buffer[i]);
}
fwrite(buffer, sizeof(uint16_t), n, stdout);
}
return 0;
}