--[[@title palette tests@param r R@default r 0@param g G@default g 0@param b B@default b 0--]]set_console_layout(0,0,40,10)base1 = 0xc0f14400base2 = 0xc0f14800function rgb_to_y(rv,gv,bv) yv = (299*rv + 587*gv + 114*bv)/1000 return(yv)endfunction rgb_to_u(rv,gv,bv) uv = (-169*rv - 331*gv + 500*bv)/1000 + 128 return(uv)endfunction rgb_to_v(rv,gv,bv) vv = (500*rv - 419*gv - 81*bv)/1000 + 128 return(vv)endy=rgb_to_y(r,g,b)u=rgb_to_u(r,g,b)v=rgb_to_v(r,g,b)print("r "..r.." g "..g.." b "..b)print("y "..y.." u "..u.." v "..v)value=v+256*u+65536*yrepeat poke(base1+4,value) poke(base2+4,value) draw_rect_filled( 0, 0, 150, 150, 1, 1, 1) sleep(100)until 2==3
--[[@title palette tests@param s start@default s 0@range s 0 255@param e end@default e 255@range e 0 255--]]base1 = 0xc0f14400base2 = 0xc0f14800paletteY={}paletteU={}paletteV={}paletteOp={}for p=0, 255 do paletteY[p]=math.random(1,255) paletteU[p]=math.random(1,255) paletteV[p]=math.random(1,255) paletteOp[p]=math.random(1,255)endrepeat for i=0, 255 do --print(i) if i>s and i<e then value=paletteU[i]+256*paletteV[i]+65536*paletteV[i] poke(base1+4*i, value) -- opacity end end sleep(100)until 2==3--------------------------
Interestingly, a good start!Have you looked at the pallet after changes in other modes, is there any change or Canon still uses his pallets without any changes?
--[[@title palette tests@param r R@default r 0@param g G@default g 0@param b B@default b 0--]]set_console_layout(0,0,40,10)base1 = 0xc0f14400base2 = 0xc0f14800function rgb_to_y(rv,gv,bv) yv = (299*rv + 587*gv + 114*bv) / 1000 return(yv)endfunction rgb_to_u(rv,gv,bv) uv = (-147*rv - 289*gv + 436*bv) / 1000 return(uv)endfunction rgb_to_v(rv,gv,bv) vv = (615*rv - 515*gv - 100*bv) / 1000 return(vv)endfunction unsign(v) -- 0 to 127 becomes 0-127 -- -128 to -1 becomes 128-255 if v<0 then v=v+256 end return(v)endy = rgb_to_y(r,g,b)u = rgb_to_u(r,g,b)v = rgb_to_v(r,g,b)us= unsign(u)vs= unsign(v)print("r:"..r.." g: "..g.. " b: "..b)print("y:"..y.." u: "..u.. " v: "..v)print("y:"..y.." us:"..us.. " vs:"..vs)value=vs+256*us+65536*yrepeat poke(base1+4,value) poke(base2+4,value) draw_rect_filled( 0, 0, 150, 150, 1, 1, 1) sleep(100)until 2==3
Unfortunately Canon firmware tries to overwrite the custom palette very often, that's why there's a repeat-until loop. But that's not big deal - if this will be incorporated to the CHDK the palette can be written to the memory every time the CHDK controls tasks (every 10ms).
Keep in mind that different generation cameras (or perhaps just different models with different display hardware ?) have different palette systems.
QuoteUnfortunately Canon firmware tries to overwrite the custom palette very often, that's why there's a repeat-until loop. But that's not big deal - if this will be incorporated to the CHDK the palette can be written to the memory every time the CHDK controls tasks (every 10ms).Actually, this is likely to lead to nasty flickering as CHDK and the Canon firmware fight over the palette, unless it is synchronized in a way that causes the CHDK one to always be present before the screen is actually updated.
Sure. So unused palette places can be only used unfortunatelly.
Started by cosmograph General Discussion and Assistance
Started by PhyrePhoX « 1 2 » General Discussion and Assistance
Started by Nikki Feature Requests
Started by KaLi General Help and Assistance on using CHDK stable releases
Started by koshy General Discussion and Assistance