pouët.net

Go to bottom

Good tips n tricks to learn coding ?

category: code [glöplog]
rudi: whether it's useful or not depends mostly on what you do with the image after converting - YUV isn't as easy to deal with as HSL. E.g. hue rotation involves vector rotation of UV with a couple of sins, instead of just an addition. More complex stuff is worse. But still, given how fast the rgb->YUV and back is, it's worth a look.

(And pure glsl here, targeting 720p at 30fps on a mobile GPU for extra challenge :D)
added on the 2011-05-18 16:34:43 by psonice psonice
i do it on a per pixel basis. never coded any shader stuff before, but you probably could do that there as well (i dont know). anyway. i have so many projects lying around.. and i code something one day and something else another day. it sucks.
added on the 2011-05-18 21:31:15 by rudi rudi
if only C could be as simple as PHP :p

no typed vars, tables, structs n all .. ahh..

well, i realize now that llearning PHP helps me a lot with the understanding of C, it's the same langage, more complicated to write lol
added on the 2011-05-19 21:37:08 by bull bull
i suppose that, to write my php "beginner-code" in C, it will be much harder, with pointers, types and all

Code: function VerifyBaieloc($champ) { if(!preg_match_all('/^[U-Uu-u][0-9][0-9][U-Uu-u][0-9][0-9]$/', $champ, $out)){ echo '<br><br><font face="verdana">Erreur: la valeur "Emplacement dans la baie" doit etre au format UXXUXX</font><br><br>'; echo '<a href="javascript:history.back()"><font face="verdana" color="#91aa37">Retourner en arriere<br></a>'; exit; } } function VerifyBaielocExist($champ, $table, $baieid) { $tableu = array(); for($i=0; $i<=42; $i++){ $tableu[] = $i; } $newtableu = array(); $get_fields = 'SELECT baie_loc FROM '.$table.' WHERE baie_id = "'.$baieid.'" ORDER BY baie_loc'; $exec_get = mysql_query($get_fields); while ($data = mysql_fetch_assoc($exec_get)) { $unumb = $data['baie_loc']; $Ustart = substr($unumb, 1, 2); $Uend = substr($unumb, 4, 5); if (preg_match('/^0/', $Ustart)) { $Ustart = str_replace("0","",$Ustart); } for ($u=$Ustart; $u<=$Uend; $u++) { $tableu[$u] = "filled"; } } $newnumb = $champ; $newUstart = substr($newnumb, 1, 2); $newUend = substr($newnumb, 4, 5); for ($i=$newUstart; $i<=$newUend; $i++) { $newtableu[$i] = "filled"; if ($tableu[$i] == "filled") { echo '<br><font face="verdana">le U '.$i.' est deja utilise, merci de choisir un autre emplacement dans le rack</font><br><br>'; echo '<a href="javascript:history.back()"><font face="verdana" color="#91aa37">Retourner en arriere<br></a>'; exit; } } }
added on the 2011-05-19 21:42:52 by bull bull
rudi: my shader version is all per-pixel too. The GPU can be much faster, but it doesn't like branching code so lots of if/else statements aren't good. And rgb->hsl and back is normally full of if/else statements :/

Speed: maybe avoid mysql in your first C experiments though ;)
added on the 2011-05-20 01:22:04 by psonice psonice
Avoid multiplying by zero. It will save you hours of debug work.
added on the 2011-05-20 03:23:54 by xernobyl xernobyl
sell your PC, buy an amiga, change its caps, and then only you will be certain to learn to code on a machine that will always be there in 20 years, thus your knowledge will be less obsolete.
added on the 2011-05-20 11:32:45 by krabob krabob
Quote:
Avoid multiplying by zero. It will save you hours of debug work.


Real coders patch the "Divison by Zero" exception vector and happily divide by zero. \o/

added on the 2011-05-20 13:18:58 by StingRay StingRay
Just don't cross the streams..
added on the 2011-05-20 16:41:34 by trc_wm trc_wm
BALLS TOUCHING
added on the 2011-05-20 16:42:37 by ferris ferris

login

Go to top