some bayer matrix things and my discoveries

This commit is contained in:
minjaesong
2017-07-17 12:22:15 +09:00
parent d6f2f4158c
commit 6476fe88bb
5 changed files with 176 additions and 27 deletions

View File

@@ -14,23 +14,23 @@ uniform float bcount = 64.0;
int bayer[12][12] = {
{0 ,96 ,64 ,8 ,104,72 ,2 ,98 ,66 ,10 ,106,74 }, // 12x12 bayer ordered dithering
{112,80 ,16 ,120,88 ,24 ,114,82 ,18 ,122,90 ,26 }, // pattern. Each input pixel
{48 ,32 ,128,56 ,40 ,136,50 ,34 ,130,58 ,42 ,138}, // is scaled to the 0..143 range
{12 ,108,76 ,4 ,100,68 ,14 ,110,78 ,6 ,102,70 }, // before looking in this table
{124,92 ,28 ,116,84 ,20 ,126,94 ,30 ,118,86 ,22 }, // to determine the action
{60 ,44 ,140,52 ,36 ,132,62 ,46 ,142,54 ,38 ,134},
{3 ,99 ,67 ,11 ,107,75 ,1 ,97 ,65 ,9 ,105,73 },
{115,83 ,19 ,123,91 ,27 ,113,81 ,17 ,121,89 ,25 },
{51 ,35 ,131,59 ,43 ,139,49 ,33 ,129,57 ,41 ,137},
{15 ,111,79 ,7 ,103,71 ,13 ,109,77 ,5 ,101,69 },
{127,95 ,31 ,119,87 ,23 ,125,93 ,29 ,117,85 ,21 },
{63 ,47 ,143,55 ,39 ,135,61 ,45 ,141,53 ,37 ,133}}; // fun fact: you can calculate bayer value on-the-fly but LUT is faster
float bayerSize = 12.0;
float bayerDivider = bayerSize * bayerSize;
int bayer[9][9] = {
{50,71,2,23,44,56,77,17,29},
{72,12,33,45,66,6,18,39,60},
{22,43,55,76,16,28,49,70,1},
{53,65,5,26,38,59,80,11,32},
{75,15,27,48,69,0,21,42,54},
{25,37,58,79,10,31,52,64,4},
{47,68,8,20,41,62,74,14,35},
{78,9,30,51,63,3,24,36,57},
{19,40,61,73,13,34,46,67,7}
};
float bayerSize = 9.0;
float bayerDivider = bayerSize * bayerSize;
vec4 nearestColour(vec4 incolor) {
vec4 rgbaCounts = vec4(rcount, gcount, bcount, 1.0);