Skip to content

Commit

Permalink
for now we start with the dumb, slow gamma calculation
Browse files Browse the repository at this point in the history
  • Loading branch information
interactive-matter committed Apr 9, 2012
1 parent b9e6963 commit 4e04fa3
Show file tree
Hide file tree
Showing 3 changed files with 39 additions and 20 deletions.
14 changes: 12 additions & 2 deletions app_ledtile/src/led/ledprocess/ledprocess.h
Expand Up @@ -41,6 +41,18 @@

//#define PER_PIXEL_ADJUSTMENT

/*
* Routine to add defaults values to the GAMMA LUT and the per pixel adjustement values, if configured.
* This routine is very slow due to the gamma calculation. And it should only be called from your applicaiton as last resort.
* Normally you would store tha gamma (and if configured the per pixel adjustements in flash). How this is handled in your application
* is part of the application.
*/
#ifdef __XC__
void ledprocess_set_defaults();
#else
void ledprocess_set_defaults();
#endif

/*
* COLOUR PROCESSING
*
Expand All @@ -53,10 +65,8 @@
* cOut - Streaming bidirectional pixel output
*/
#ifdef __XC__
void ledprocess_init();
int ledprocess_commands(streaming chanend cLedCmd, streaming chanend cOut, int oeen);
#else
void ledprocess_init();
int ledprocess_commands(unsigned cLedCmd, unsigned cOut, int oeen);
#endif

Expand Down
9 changes: 7 additions & 2 deletions app_ledtile/src/led/ledprocess/ledprocess.xc
Expand Up @@ -13,21 +13,26 @@
**/
#include <xs1.h>
#include <xclib.h>
#include <print.h>
#include "led.h"
#include "ledprocess.h"
#include "print.h"
#include "gamma_lut_builder.h"

//8 bit color intensity adjustements
unsigned char intensityadjust[3] = {0xFF, 0xFF, 0xFF};
//16 bit gamma look up table
unsigned short gammaLUT[3][256];

#pragma unsafe arrays
void ledprocess_init()
void ledprocess_set_defaults()
{
// Init pixintensity
//TODO this is rubbish here. 1st it does not work 2nd this should be done in the aaplication or so, not the driver (see mbi5026)
//TODO may be this should be renamed to init-defaults and be a fall back if there is no applicaiton routine
//anyway we initialive the gamma lut for now
for (int c=0; c<3; c++) {
buildGammaLUT(gammaLUT[c]);

This comment has been minimized.

Copy link
@variar

variar Apr 10, 2012

Contributor

As far as I understand, initial values for each color are the same. Calculating initial table only for gammaLUT[0] and coping it to gammaLUT[1] and gammaLUT[2] might be a little bit faster.

}
#ifdef PER_PIXEL_ADJUSTMENT
for (int i=0; i<(FRAME_HEIGHT*FRAME_WIDTH*3); i++)
{
Expand Down
36 changes: 20 additions & 16 deletions app_ledtile/src/main.xc
Expand Up @@ -145,26 +145,30 @@ int main(void)

//TODO we must find a way to select the correct led driver at startup - perhaps from flash??
//this needs to be done so taht each led driver can define & use the pins it wants to use
on stdcore[0]: {
//for now it is enough to get some default values
ledprocess_set_defaults(); //TODO this should be part of the ethernet application (loading from flash, if not useful initialize)
#if defined MBI5031
on stdcore[0]: leddrive_mbi5031(c_led_data_out, c_led_cmds_out, cWdog[0],
p_led_out_r0, p_led_out_g0, p_led_out_b0, p_led_out_g1, p_led_out_b1,
p_led_out_addr, p_led_out_clk , p_led_out_ltch, p_led_out_oe ,
b_led_clk, b_led_data, b_led_gsclk, b_ref);
leddrive_mbi5031(c_led_data_out, c_led_cmds_out, cWdog[0],
p_led_out_r0, p_led_out_g0, p_led_out_b0, p_led_out_g1, p_led_out_b1,
p_led_out_addr, p_led_out_clk , p_led_out_ltch, p_led_out_oe ,
b_led_clk, b_led_data, b_led_gsclk, b_ref);
#elif defined MBI5030
on stdcore[0]: leddrive_mbi5030(
c_led_data_out, c_led_cmds_out, cWdog[0],
p_led_out_r0, p_led_out_g0, p_led_out_b0,
p_led_out_r1, p_led_out_g1, p_led_out_b1,
p_led_out_addr, p_led_out_clk , p_led_out_ltch, p_led_out_oe ,
b_led_clk, b_led_data, b_led_gsclk, b_ref);
leddrive_mbi5030(
c_led_data_out, c_led_cmds_out, cWdog[0],
p_led_out_r0, p_led_out_g0, p_led_out_b0,
p_led_out_r1, p_led_out_g1, p_led_out_b1,
p_led_out_addr, p_led_out_clk , p_led_out_ltch, p_led_out_oe ,
b_led_clk, b_led_data, b_led_gsclk, b_ref);
#elif defined MBI5026
on stdcore[0]: leddrive_mbi5026(
c_led_data_out, c_led_cmds_out, cWdog[0],
p_led_out_r0, p_led_out_g0, p_led_out_b0,
p_led_out_r1, p_led_out_g1, p_led_out_b1,
p_led_out_addr, p_led_out_clk , p_led_out_ltch, p_led_out_oe ,
b_led_clk, b_led_data, b_led_gsclk, b_ref);
leddrive_mbi5026(
c_led_data_out, c_led_cmds_out, cWdog[0],
p_led_out_r0, p_led_out_g0, p_led_out_b0,
p_led_out_r1, p_led_out_g1, p_led_out_b1,
p_led_out_addr, p_led_out_clk , p_led_out_ltch, p_led_out_oe ,
b_led_clk, b_led_data, b_led_gsclk, b_ref);
#endif
}
//the interface to the flash memory for config data
on stdcore[0]: spiFlash(cSpiFlash, p_flash_miso, p_flash_ss, p_flash_clk, p_flash_mosi, b_flash_clk, b_flash_data);

Expand Down

0 comments on commit 4e04fa3

Please sign in to comment.