"varying vec4 out_yblockpos_y;\n"\r
"varying vec4 out_uvblockpos_xy;\n"\r
"varying vec2 out_block_edge;\n"\r
+ "varying vec4 out_block_types;\n"\r
\r
"const float one=1.0;\n"\r
"const float c1024=1024.0;\n"\r
"const float c32=32.0;\n"\r
+ // "const float c1over32=0.03125;\n"\r
+ "const float c1over32=1./32.;\n"\r
\r
\r
"const float c65536=65536.;\n"\r
" vec4 cbp_vec=vec4(cbp,cbp,cbp,cbp);\n"\r
" vec4 fmod_cbp_y=mod(cbp_vec,y_cbp);\n"\r
" vec2 fmod_cbp_uv=mod(cbp_vec.xy,uv_cbp);\n"\r
+ " fmod_cbp_y.x=0.;\n"\r
" fmod_cbp_y=sign(vec4(fmod_cbp_y.yzw,fmod_cbp_uv.x)-fmod_cbp_y);\n"\r
" fmod_cbp_uv=sign(vec2(fmod_cbp_uv.y,cbp)-fmod_cbp_uv);\n"\r
// resulting vector should indicate with block is present\r
" fmod_cbp_uv2.y+=fmod_cbp_uv2.x;\n"\r
\r
// now calculate their position inside the short array\r
- " float m_index=index.x+index.y*c65536;\n" //Not Endian save\r
+ " float m_index=index.x/*+index.y*c65536*/-one;\n" //Not Endian save\r
" fmod_cbp_y2+=m_index;\n" //shift to the blocks\r
" fmod_cbp_uv2+=m_index;\n"\r
- " out_yblockpos_x=mod(fmod_cbp_y2,c32);\n"\r
- " out_uvblockpos_xy.xy=mod(fmod_cbp_uv2,c32);\n"\r
- " out_yblockpos_y=floor((fmod_cbp_y2)/c32);\n"\r
- " out_uvblockpos_xy.zw=floor((fmod_cbp_uv2)/c32);\n"\r
+ //" out_yblockpos_x=(mod(fmod_cbp_y2,c32));\n"\r
+ //" out_uvblockpos_xy.xy=(mod(fmod_cbp_uv2,c32));\n"\r
+ //" out_yblockpos_y=floor((fmod_cbp_y2)/c32);\n"\r
+ //" out_uvblockpos_xy.zw=floor((fmod_cbp_uv2)/c32);\n"\r
+\r
+ " out_yblockpos_y=floor((fmod_cbp_y2)*c1over32);\n"\r
+ " out_uvblockpos_xy.zw=floor((fmod_cbp_uv2)*c1over32);\n"\r
+ " out_yblockpos_x=fmod_cbp_y2-c32*out_yblockpos_y;\n"\r
+ " out_uvblockpos_xy.xy=fmod_cbp_uv2-c32*out_uvblockpos_xy.zw;\n"\r
+\r
+\r
\r
//Kick out uncoded blocks\r
" out_yblockpos_y-=sign(fmod_cbp_y-one)*c1024;\n"\r
\r
\r
" out_block_edge=block_edge;\n"\r
+ " out_block_types=block_types;\n"\r
" vec4 out_pos=block_pos;\n"\r
" out_pos.xy+=block_edge;\n"\r
" out_pos.xy*=pict_scale;\n"\r
"varying vec4 out_yblockpos_y;\n"\r
"varying vec4 out_uvblockpos_xy;\n"\r
"varying vec2 out_block_edge;\n"\r
+ "varying vec4 out_block_types;\n"\r
+\r
"const float halfst=0.5;\n"\r
"const float ctwo=2.0;\n"\r
+ "const float cone=1.0;\n"\r
"const float sieben=7.0;\n"\r
"const float acht=8.0;\n"\r
"const float s8=1./8.;\n"\r
"const float s16=1./16.;\n"\r
- "const float c1over2047=1./2047.;\n"\r
- "const float c1over1023=1./1023.;\n"\r
+ "const float c1over2048=1./2048.;\n"\r
+ "const float c1over1024=1./1024.;\n"\r
"const float c255=255.;\n"\r
"const float c65280=65280.;\n"\r
"const float c65536=65536.;\n"\r
"{\n"\r
// first figure out the block num for y, first decide between up and down, fix me field\r
//non field code\r
- // " vec4 ypos_temp1=mix(vec4(out_yblockpos_x.x,out_yblockpos_y.x,out_yblockpos_x.y,out_yblockpos_y.y),"\r
+ " vec4 ypos_temp1;\n"\r
+ " bool upper_half;\n"\r
+ " float line_step;\n"\r
+ " if (out_block_types.w!=0.) {\n" //test the dct type\r
+ " upper_half=mod(floor(out_block_edge.y*acht),ctwo)==cone;\n"\r
+ " line_step=cone;\n"\r
+ "}else{\n"\r
+ " upper_half=halfst<out_block_edge.y;\n"\r
+ " line_step=ctwo;\n"\r
+ "}\n"\r
+ " if (upper_half) {\n"\r
+ " ypos_temp1=vec4(out_yblockpos_x.z,out_yblockpos_y.z,out_yblockpos_x.w,out_yblockpos_y.w);\n"\r
+ " } else {\n"\r
+ " ypos_temp1=vec4(out_yblockpos_x.x,out_yblockpos_y.x,out_yblockpos_x.y,out_yblockpos_y.y);\n"\r
+ " }\n"\r
+ // " vec4 ypos_temp1=mix(vec4(out_yblockpos_x.x,out_yblockpos_y.x,out_yblockpos_x.y,out_yblockpos_y.y),"\r
// " vec4(out_yblockpos_x.z,out_yblockpos_y.z,out_yblockpos_x.w,out_yblockpos_y.w),step(halfst,out_block_edge.y));\n"\r
//field code\r
- " vec4 ypos_temp1=mix(vec4(out_yblockpos_x.x,out_yblockpos_y.x,out_yblockpos_x.y,out_yblockpos_y.y),"\r
- " vec4(out_yblockpos_x.z,out_yblockpos_y.z,out_yblockpos_x.w,out_yblockpos_y.w),step(s16,mod(out_block_edge.y,s8)));\n"\r
+ // " vec4 ypos_temp1=mix(vec4(out_yblockpos_x.x,out_yblockpos_y.x,out_yblockpos_x.y,out_yblockpos_y.y),"\r
+ // " vec4(out_yblockpos_x.z,out_yblockpos_y.z,out_yblockpos_x.w,out_yblockpos_y.w),step(s16,mod(out_block_edge.y,s8)));\n"\r
\r
//decide between left and right\r
- " vec2 ypos_temp2=mix(ypos_temp1.xy,ypos_temp1.zw,step(halfst,out_block_edge.x));\n"\r
+ " vec4 ypos_temp2;\n"\r
+ "if (halfst<out_block_edge.x){\n"\r
+ " ypos_temp2.xy=ypos_temp1.zw;\n"\r
+ " }else {\n"\r
+ " ypos_temp2.xy=ypos_temp1.xy;\n"\r
+ " }\n"\r
//now get the intra 8x8 Block coordinates\r
- " vec2 ypos_temp3=mod(out_block_edge,halfst)*ctwo;\n"\r
- " ypos_temp2.x=(ypos_temp3.x*sieben+(ypos_temp3.y*sieben+acht*ypos_temp2.x)*acht)*c1over2047;\n"\r
- " ypos_temp2.y*=c1over1023;\n"\r
- " ypos_temp1=texture2D(blocks,ypos_temp2);\n" // now select the right data\r
- " ypos_temp2=mix(ypos_temp1.rg,ypos_temp1.ba,step(c1over2047,mod(ypos_temp2.x,c1over1023)));\n" //activate this\r
-\r
- " gl_FragColor.r=unpack_short(ypos_temp2.rg);\n" //signed later TODO\r
- //" gl_FragColor.r=ypos_temp1.b;\n" //signed later TODO\r
- " gl_FragColor.g=0.5;\n"\r
- " gl_FragColor.b=0.5;\n"\r
+ " vec2 ypos_temp3=floor(mod(out_block_edge*vec2(ctwo,line_step),cone)*acht);\n"\r
+ " ypos_temp2.x=(ypos_temp3.x+(ypos_temp3.y+acht*(ypos_temp2.x))*acht);\n"\r
+ //" bool subsample=(mod(ypos_temp2.x,ctwo)>halfst);\n"\r
+ " bool subsample=mod(ypos_temp3.x,ctwo)==cone;\n"\r
+ " ypos_temp2.x*=halfst;\n"\r
+ " ypos_temp2.xy*=c1over1024;\n"\r
+ " ypos_temp1=texture2D(blocks,ypos_temp2.xy);\n" // now select the right data\r
+ "if (subsample){\n"\r
+ " ypos_temp2.xy=ypos_temp1.zw;\n"\r
+ //" ypos_temp2=vec2(cone,0.);\n"\r
+ " }else {\n"\r
+ " ypos_temp2.xy=ypos_temp1.xy;\n"\r
+ " }\n"\r
+ " gl_FragColor.r=unpack_short(ypos_temp2.rg);\n"\r
+\r
+ //now uv\r
+ " ypos_temp3=floor(out_block_edge*acht);\n"\r
+ " ypos_temp2.yw=floor(out_uvblockpos_xy.zw);\n"\r
+ " ypos_temp2.xz=(ypos_temp3.x+(ypos_temp3.y+acht*(out_uvblockpos_xy.xy))*acht);\n"\r
+ //" bool subsample=(mod(ypos_temp2.x,ctwo)>halfst);\n"\r
+ " subsample=mod(ypos_temp3.x,ctwo)==cone;\n"\r
+ " ypos_temp2.xz*=halfst;\n"\r
+ " ypos_temp2*=c1over1024;\n"\r
+\r
+ " ypos_temp1=texture2D(blocks,ypos_temp2.xy);\n" // now select the right data\r
+ " if (subsample){\n"\r
+ " ypos_temp2.xy=ypos_temp1.zw;\n"\r
+ " }else {\n"\r
+ " ypos_temp2.xy=ypos_temp1.xy;\n"\r
+ " }\n"\r
+ " gl_FragColor.g=unpack_short(ypos_temp2.rg);\n"\r
+\r
+ " ypos_temp1=texture2D(blocks,ypos_temp2.zw);\n" // now select the right data\r
+ " if (subsample){\n"\r
+ " ypos_temp2.xy=ypos_temp1.zw;\n"\r
+ " }else {\n"\r
+ " ypos_temp2.xy=ypos_temp1.xy;\n"\r
+ " }\n"\r
+ " gl_FragColor.b=unpack_short(ypos_temp2.rg);\n"\r
+\r
+\r
+ //" ypos_temp2=mix(ypos_temp1.rg,ypos_temp1.ba,step(c1over2047,mod(ypos_temp2.x,c1over1023)));\n" //activate this\r
+\r
+\r
+ //" gl_FragColor.r=subsample/acht;\n" //signed later TODO\r
+ //" gl_FragColor.g=0.5;\n"\r
+ //" gl_FragColor.b=0.5;\n"\r
" gl_FragColor.a=1.0;\n"\r
//" vec4 blocks=texture2D(blocks,gl_FragCoord.xy/600.);\n"\r
// "help.x=texture2D(textureY,out_texCoord).r;\n"\r