MCPcopy Create free account
hub / github.com/OpenNFS/OpenNFS / Decode4

Function Decode4

include/bmpread/bmpread.c:757–783  ·  view source on GitHub ↗

Decodes 4-bit bitmap data by looking colors up in the palette. */

Source from the content-addressed store, hash-verified

755/* Decodes 4-bit bitmap data by looking colors up in the palette.
756 */
757static void Decode4(uint8_t * p_out,
758 const uint8_t * p_out_end,
759 const uint8_t * p_file,
760 const read_context * p_ctx)
761{
762 while(p_out < p_out_end)
763 {
764 unsigned int lookup = (*p_file & 0xf0U) >> 4;
765
766 *p_out++ = p_ctx->palette[lookup].red;
767 *p_out++ = p_ctx->palette[lookup].green;
768 *p_out++ = p_ctx->palette[lookup].blue;
769 if(p_ctx->out_channels == 4)
770 *p_out++ = BMPREAD_DEFAULT_ALPHA;
771
772 if(p_out < p_out_end)
773 {
774 lookup = *p_file++ & 0x0fU;
775
776 *p_out++ = p_ctx->palette[lookup].red;
777 *p_out++ = p_ctx->palette[lookup].green;
778 *p_out++ = p_ctx->palette[lookup].blue;
779 if(p_ctx->out_channels == 4)
780 *p_out++ = BMPREAD_DEFAULT_ALPHA;
781 }
782 }
783}
784
785/* Decodes 1-bit bitmap data by looking colors up in the two-color palette.
786 */

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected