format_conversion.effect 44 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202120312041205120612071208120912101211121212131214121512161217121812191220122112221223122412251226122712281229123012311232123312341235123612371238123912401241124212431244124512461247124812491250125112521253125412551256125712581259126012611262126312641265126612671268126912701271127212731274127512761277127812791280128112821283128412851286128712881289129012911292129312941295129612971298129913001301130213031304130513061307130813091310131113121313131413151316131713181319132013211322132313241325132613271328132913301331133213331334133513361337133813391340134113421343134413451346134713481349135013511352135313541355135613571358135913601361136213631364136513661367136813691370137113721373137413751376137713781379138013811382138313841385138613871388138913901391139213931394139513961397139813991400140114021403140414051406140714081409141014111412141314141415141614171418141914201421142214231424142514261427142814291430143114321433143414351436143714381439144014411442144314441445144614471448144914501451145214531454145514561457145814591460146114621463146414651466146714681469147014711472147314741475147614771478147914801481148214831484148514861487148814891490149114921493149414951496149714981499150015011502150315041505150615071508150915101511151215131514151515161517151815191520152115221523152415251526152715281529153015311532153315341535153615371538153915401541154215431544154515461547154815491550155115521553155415551556155715581559156015611562156315641565156615671568156915701571157215731574157515761577157815791580158115821583158415851586158715881589159015911592159315941595159615971598159916001601160216031604160516061607160816091610161116121613161416151616161716181619162016211622162316241625162616271628162916301631163216331634163516361637163816391640164116421643164416451646164716481649165016511652165316541655165616571658165916601661166216631664166516661667166816691670167116721673167416751676167716781679168016811682168316841685168616871688168916901691169216931694169516961697169816991700170117021703170417051706170717081709171017111712171317141715171617171718171917201721172217231724172517261727172817291730173117321733173417351736173717381739174017411742174317441745174617471748174917501751175217531754175517561757175817591760176117621763176417651766176717681769177017711772177317741775177617771778177917801781178217831784178517861787178817891790179117921793179417951796179717981799180018011802180318041805180618071808180918101811181218131814181518161817181818191820182118221823
  1. /******************************************************************************
  2. Copyright (C) 2023 by Lain Bailey <lain@obsproject.com>
  3. This program is free software: you can redistribute it and/or modify
  4. it under the terms of the GNU General Public License as published by
  5. the Free Software Foundation, either version 2 of the License, or
  6. (at your option) any later version.
  7. This program is distributed in the hope that it will be useful,
  8. but WITHOUT ANY WARRANTY; without even the implied warranty of
  9. MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  10. GNU General Public License for more details.
  11. You should have received a copy of the GNU General Public License
  12. along with this program. If not, see <http://www.gnu.org/licenses/>.
  13. ******************************************************************************/
  14. #include "color.effect"
  15. uniform float width;
  16. uniform float height;
  17. uniform float width_i;
  18. uniform float height_i;
  19. uniform float width_d2;
  20. uniform float height_d2;
  21. uniform float width_x2_i;
  22. uniform float height_x2_i;
  23. uniform float maximum_over_sdr_white_nits;
  24. uniform float sdr_white_nits_over_maximum;
  25. uniform float hlg_exponent;
  26. uniform float hdr_lw;
  27. uniform float hdr_lmax;
  28. uniform float4 color_vec0;
  29. uniform float4 color_vec1;
  30. uniform float4 color_vec2;
  31. uniform float3 color_range_min = {0.0, 0.0, 0.0};
  32. uniform float3 color_range_max = {1.0, 1.0, 1.0};
  33. uniform texture2d image;
  34. uniform texture2d image1;
  35. uniform texture2d image2;
  36. uniform texture2d image3;
  37. sampler_state def_sampler {
  38. Filter = Linear;
  39. AddressU = Clamp;
  40. AddressV = Clamp;
  41. };
  42. struct FragPos {
  43. float4 pos : POSITION;
  44. };
  45. struct VertTexPos {
  46. float2 uv : TEXCOORD0;
  47. float4 pos : POSITION;
  48. };
  49. struct VertTexTexPos {
  50. float4 uvuv : TEXCOORD0;
  51. float4 pos : POSITION;
  52. };
  53. struct VertTexPosWide {
  54. float3 uuv : TEXCOORD0;
  55. float4 pos : POSITION;
  56. };
  57. struct VertTexPosWideWide {
  58. float4 uuvv : TEXCOORD0;
  59. float4 pos : POSITION;
  60. };
  61. struct FragTex {
  62. float2 uv : TEXCOORD0;
  63. };
  64. struct FragTexTex {
  65. float4 uvuv : TEXCOORD0;
  66. };
  67. struct FragTexWide {
  68. float3 uuv : TEXCOORD0;
  69. };
  70. struct FragTexWideWide {
  71. float4 uuvv : TEXCOORD0;
  72. };
  73. FragPos VSPos(uint id : VERTEXID)
  74. {
  75. float idHigh = float(id >> 1);
  76. float idLow = float(id & uint(1));
  77. float x = idHigh * 4.0 - 1.0;
  78. float y = idLow * 4.0 - 1.0;
  79. FragPos vert_out;
  80. vert_out.pos = float4(x, y, 0.0, 1.0);
  81. return vert_out;
  82. }
  83. VertTexPosWide VSTexPos_Left(uint id : VERTEXID)
  84. {
  85. float idHigh = float(id >> 1);
  86. float idLow = float(id & uint(1));
  87. float x = idHigh * 4.0 - 1.0;
  88. float y = idLow * 4.0 - 1.0;
  89. float u_right = idHigh * 2.0;
  90. float u_left = u_right - width_i;
  91. float v = obs_glsl_compile ? (idLow * 2.0) : (1.0 - idLow * 2.0);
  92. VertTexPosWide vert_out;
  93. vert_out.uuv = float3(u_left, u_right, v);
  94. vert_out.pos = float4(x, y, 0.0, 1.0);
  95. return vert_out;
  96. }
  97. VertTexPosWideWide VSTexPos_TopLeft(uint id : VERTEXID)
  98. {
  99. float idHigh = float(id >> 1);
  100. float idLow = float(id & uint(1));
  101. float x = idHigh * 4.0 - 1.0;
  102. float y = idLow * 4.0 - 1.0;
  103. float u_right = idHigh * 2.0;
  104. float u_left = u_right - width_i;
  105. float v_bottom;
  106. float v_top;
  107. if (obs_glsl_compile) {
  108. v_bottom = idLow * 2.0;
  109. v_top = v_bottom + height_i;
  110. } else {
  111. v_bottom = 1.0 - idLow * 2.0;
  112. v_top = v_bottom - height_i;
  113. }
  114. VertTexPosWideWide vert_out;
  115. vert_out.uuvv = float4(u_left, u_right, v_top, v_bottom);
  116. vert_out.pos = float4(x, y, 0.0, 1.0);
  117. return vert_out;
  118. }
  119. VertTexTexPos VSPacked422Left_Reverse(uint id : VERTEXID)
  120. {
  121. float idHigh = float(id >> 1);
  122. float idLow = float(id & uint(1));
  123. float x = idHigh * 4. - 1.;
  124. float y = idLow * 4. - 1.;
  125. float u = idHigh * 2.;
  126. float v = idLow * 2.;
  127. v = obs_glsl_compile ? v : (1. - v);
  128. VertTexTexPos vert_out;
  129. vert_out.uvuv = float4(width_d2 * u, height * v, u + width_x2_i, v);
  130. vert_out.pos = float4(x, y, 0., 1.);
  131. return vert_out;
  132. }
  133. VertTexPos VS420Left_Reverse(uint id : VERTEXID)
  134. {
  135. float idHigh = float(id >> 1);
  136. float idLow = float(id & uint(1));
  137. float x = idHigh * 4. - 1.;
  138. float y = idLow * 4. - 1.;
  139. float u = idHigh * 2. + width_x2_i;
  140. float v = idLow * 2.;
  141. v = obs_glsl_compile ? v : (1. - v);
  142. VertTexPos vert_out;
  143. vert_out.uv = float2(u, v);
  144. vert_out.pos = float4(x, y, 0., 1.);
  145. return vert_out;
  146. }
  147. VertTexPos VS420TopLeft_Reverse(uint id : VERTEXID)
  148. {
  149. float idHigh = float(id >> 1);
  150. float idLow = float(id & uint(1));
  151. float x = idHigh * 4. - 1.;
  152. float y = idLow * 4. - 1.;
  153. float u = idHigh * 2. + width_x2_i;
  154. float v = idLow * 2. - height_x2_i;
  155. v = obs_glsl_compile ? v : (1. - v);
  156. VertTexPos vert_out;
  157. vert_out.uv = float2(u, v);
  158. vert_out.pos = float4(x, y, 0., 1.);
  159. return vert_out;
  160. }
  161. VertTexPos VS422Left_Reverse(uint id : VERTEXID)
  162. {
  163. float idHigh = float(id >> 1);
  164. float idLow = float(id & uint(1));
  165. float x = idHigh * 4.0 - 1.0;
  166. float y = idLow * 4.0 - 1.0;
  167. float u = idHigh * 2.0 + width_x2_i;
  168. float v = obs_glsl_compile ? (idLow * 2.0) : (1.0 - idLow * 2.0);
  169. VertTexPos vert_out;
  170. vert_out.uv = float2(u, v);
  171. vert_out.pos = float4(x, y, 0.0, 1.0);
  172. return vert_out;
  173. }
  174. float PS_Y(FragPos frag_in) : TARGET
  175. {
  176. float3 rgb = image.Load(int3(frag_in.pos.xy, 0)).rgb;
  177. float y = dot(color_vec0.xyz, rgb) + color_vec0.w;
  178. return y;
  179. }
  180. float PS_P010_PQ_Y_709_2020(FragPos frag_in) : TARGET
  181. {
  182. float3 rgb = image.Load(int3(frag_in.pos.xy, 0)).rgb * sdr_white_nits_over_maximum;
  183. rgb = rec709_to_rec2020(rgb);
  184. rgb = linear_to_st2084(rgb);
  185. float y = dot(color_vec0.xyz, rgb) + color_vec0.w;
  186. y = floor(saturate(y) * 1023. + 0.5) * (64. / 65535.);
  187. return y;
  188. }
  189. float PS_P010_HLG_Y_709_2020(FragPos frag_in) : TARGET
  190. {
  191. float3 rgb = image.Load(int3(frag_in.pos.xy, 0)).rgb * sdr_white_nits_over_maximum;
  192. rgb = rec709_to_rec2020(rgb);
  193. rgb = linear_to_hlg(rgb, hdr_lw);
  194. float y = dot(color_vec0.xyz, rgb) + color_vec0.w;
  195. y = floor(saturate(y) * 1023. + 0.5) * (64. / 65535.);
  196. return y;
  197. }
  198. float PS_P010_SRGB_Y(FragPos frag_in) : TARGET
  199. {
  200. float3 rgb = image.Load(int3(frag_in.pos.xy, 0)).rgb;
  201. rgb = srgb_linear_to_nonlinear(rgb);
  202. float y = dot(color_vec0.xyz, rgb) + color_vec0.w;
  203. y = floor(saturate(y) * 1023. + 0.5) * (64. / 65535.);
  204. return y;
  205. }
  206. float PS_P216_PQ_Y_709_2020(FragPos frag_in) : TARGET
  207. {
  208. float3 rgb = image.Load(int3(frag_in.pos.xy, 0)).rgb * sdr_white_nits_over_maximum;
  209. rgb = rec709_to_rec2020(rgb);
  210. rgb = linear_to_st2084(rgb);
  211. float y = dot(color_vec0.xyz, rgb) + color_vec0.w;
  212. return y;
  213. }
  214. float PS_P216_HLG_Y_709_2020(FragPos frag_in) : TARGET
  215. {
  216. float3 rgb = image.Load(int3(frag_in.pos.xy, 0)).rgb * sdr_white_nits_over_maximum;
  217. rgb = rec709_to_rec2020(rgb);
  218. rgb = linear_to_hlg(rgb, hdr_lw);
  219. float y = dot(color_vec0.xyz, rgb) + color_vec0.w;
  220. return y;
  221. }
  222. float PS_P216_SRGB_Y(FragPos frag_in) : TARGET
  223. {
  224. float3 rgb = image.Load(int3(frag_in.pos.xy, 0)).rgb;
  225. rgb = srgb_linear_to_nonlinear(rgb);
  226. float y = dot(color_vec0.xyz, rgb) + color_vec0.w;
  227. return y;
  228. }
  229. float PS_P416_PQ_Y_709_2020(FragPos frag_in) : TARGET
  230. {
  231. float3 rgb = image.Load(int3(frag_in.pos.xy, 0)).rgb * sdr_white_nits_over_maximum;
  232. rgb = rec709_to_rec2020(rgb);
  233. rgb = linear_to_st2084(rgb);
  234. float y = dot(color_vec0.xyz, rgb) + color_vec0.w;
  235. return y;
  236. }
  237. float PS_P416_HLG_Y_709_2020(FragPos frag_in) : TARGET
  238. {
  239. float3 rgb = image.Load(int3(frag_in.pos.xy, 0)).rgb * sdr_white_nits_over_maximum;
  240. rgb = rec709_to_rec2020(rgb);
  241. rgb = linear_to_hlg(rgb, hdr_lw);
  242. float y = dot(color_vec0.xyz, rgb) + color_vec0.w;
  243. return y;
  244. }
  245. float PS_P416_SRGB_Y(FragPos frag_in) : TARGET
  246. {
  247. float3 rgb = image.Load(int3(frag_in.pos.xy, 0)).rgb;
  248. rgb = srgb_linear_to_nonlinear(rgb);
  249. float y = dot(color_vec0.xyz, rgb) + color_vec0.w;
  250. return y;
  251. }
  252. float PS_I010_PQ_Y_709_2020(FragPos frag_in) : TARGET
  253. {
  254. float3 rgb = image.Load(int3(frag_in.pos.xy, 0)).rgb * sdr_white_nits_over_maximum;
  255. rgb = rec709_to_rec2020(rgb);
  256. rgb = linear_to_st2084(rgb);
  257. float y = dot(color_vec0.xyz, rgb) + color_vec0.w;
  258. return y * (1023. / 65535.);
  259. }
  260. float PS_I010_HLG_Y_709_2020(FragPos frag_in) : TARGET
  261. {
  262. float3 rgb = image.Load(int3(frag_in.pos.xy, 0)).rgb * sdr_white_nits_over_maximum;
  263. rgb = rec709_to_rec2020(rgb);
  264. rgb = linear_to_hlg(rgb, hdr_lw);
  265. float y = dot(color_vec0.xyz, rgb) + color_vec0.w;
  266. return y * (1023. / 65535.);
  267. }
  268. float PS_I010_SRGB_Y(FragPos frag_in) : TARGET
  269. {
  270. float3 rgb = image.Load(int3(frag_in.pos.xy, 0)).rgb;
  271. rgb = srgb_linear_to_nonlinear(rgb);
  272. float y = dot(color_vec0.xyz, rgb) + color_vec0.w;
  273. return y * (1023. / 65535.);
  274. }
  275. float2 PS_UV_Wide(FragTexWide frag_in) : TARGET
  276. {
  277. float3 rgb_left = image.Sample(def_sampler, frag_in.uuv.xz).rgb;
  278. float3 rgb_right = image.Sample(def_sampler, frag_in.uuv.yz).rgb;
  279. float3 rgb = (rgb_left + rgb_right) * 0.5;
  280. float u = dot(color_vec1.xyz, rgb) + color_vec1.w;
  281. float v = dot(color_vec2.xyz, rgb) + color_vec2.w;
  282. return float2(u, v);
  283. }
  284. float2 PS_P010_PQ_UV_709_2020_WideWide(FragTexWideWide frag_in) : TARGET
  285. {
  286. float3 rgb_topleft = image.Sample(def_sampler, frag_in.uuvv.xz).rgb;
  287. float3 rgb_topright = image.Sample(def_sampler, frag_in.uuvv.yz).rgb;
  288. float3 rgb_bottomleft = image.Sample(def_sampler, frag_in.uuvv.xw).rgb;
  289. float3 rgb_bottomright = image.Sample(def_sampler, frag_in.uuvv.yw).rgb;
  290. float3 rgb = (rgb_topleft + rgb_topright + rgb_bottomleft + rgb_bottomright) * (0.25 * sdr_white_nits_over_maximum);
  291. rgb = rec709_to_rec2020(rgb);
  292. rgb = linear_to_st2084(rgb);
  293. float u = dot(color_vec1.xyz, rgb) + color_vec1.w;
  294. float v = dot(color_vec2.xyz, rgb) + color_vec2.w;
  295. float2 uv = float2(u, v);
  296. uv = floor(saturate(uv) * 1023. + 0.5) * (64. / 65535.);
  297. return uv;
  298. }
  299. float2 PS_P010_HLG_UV_709_2020_WideWide(FragTexWideWide frag_in) : TARGET
  300. {
  301. float3 rgb_topleft = image.Sample(def_sampler, frag_in.uuvv.xz).rgb;
  302. float3 rgb_topright = image.Sample(def_sampler, frag_in.uuvv.yz).rgb;
  303. float3 rgb_bottomleft = image.Sample(def_sampler, frag_in.uuvv.xw).rgb;
  304. float3 rgb_bottomright = image.Sample(def_sampler, frag_in.uuvv.yw).rgb;
  305. float3 rgb = (rgb_topleft + rgb_topright + rgb_bottomleft + rgb_bottomright) * (0.25 * sdr_white_nits_over_maximum);
  306. rgb = rec709_to_rec2020(rgb);
  307. rgb = linear_to_hlg(rgb, hdr_lw);
  308. float u = dot(color_vec1.xyz, rgb) + color_vec1.w;
  309. float v = dot(color_vec2.xyz, rgb) + color_vec2.w;
  310. float2 uv = float2(u, v);
  311. uv = floor(saturate(uv) * 1023. + 0.5) * (64. / 65535.);
  312. return uv;
  313. }
  314. float2 PS_P010_SRGB_UV_Wide(FragTexWide frag_in) : TARGET
  315. {
  316. float3 rgb_left = image.Sample(def_sampler, frag_in.uuv.xz).rgb;
  317. float3 rgb_right = image.Sample(def_sampler, frag_in.uuv.yz).rgb;
  318. float3 rgb = (rgb_left + rgb_right) * 0.5;
  319. rgb = srgb_linear_to_nonlinear(rgb);
  320. float u = dot(color_vec1.xyz, rgb) + color_vec1.w;
  321. float v = dot(color_vec2.xyz, rgb) + color_vec2.w;
  322. float2 uv = float2(u, v);
  323. uv = floor(saturate(uv) * 1023. + 0.5) * (64. / 65535.);
  324. return uv;
  325. }
  326. float2 PS_P216_PQ_UV_709_2020_Wide(FragTexWide frag_in) : TARGET
  327. {
  328. float3 rgb_left = image.Sample(def_sampler, frag_in.uuv.xz).rgb;
  329. float3 rgb_right = image.Sample(def_sampler, frag_in.uuv.yz).rgb;
  330. float3 rgb = (rgb_left + rgb_right) * (0.5 * sdr_white_nits_over_maximum);
  331. rgb = rec709_to_rec2020(rgb);
  332. rgb = linear_to_st2084(rgb);
  333. float u = dot(color_vec1.xyz, rgb) + color_vec1.w;
  334. float v = dot(color_vec2.xyz, rgb) + color_vec2.w;
  335. float2 uv = float2(u, v);
  336. return uv;
  337. }
  338. float2 PS_P216_HLG_UV_709_2020_Wide(FragTexWide frag_in) : TARGET
  339. {
  340. float3 rgb_left = image.Sample(def_sampler, frag_in.uuv.xz).rgb;
  341. float3 rgb_right = image.Sample(def_sampler, frag_in.uuv.yz).rgb;
  342. float3 rgb = (rgb_left + rgb_right) * (0.5 * sdr_white_nits_over_maximum);
  343. rgb = rec709_to_rec2020(rgb);
  344. rgb = linear_to_hlg(rgb, hdr_lw);
  345. float u = dot(color_vec1.xyz, rgb) + color_vec1.w;
  346. float v = dot(color_vec2.xyz, rgb) + color_vec2.w;
  347. float2 uv = float2(u, v);
  348. return uv;
  349. }
  350. float2 PS_P216_SRGB_UV_Wide(FragTexWide frag_in) : TARGET
  351. {
  352. float3 rgb_left = image.Sample(def_sampler, frag_in.uuv.xz).rgb;
  353. float3 rgb_right = image.Sample(def_sampler, frag_in.uuv.yz).rgb;
  354. float3 rgb = (rgb_left + rgb_right) * 0.5;
  355. rgb = srgb_linear_to_nonlinear(rgb);
  356. float u = dot(color_vec1.xyz, rgb) + color_vec1.w;
  357. float v = dot(color_vec2.xyz, rgb) + color_vec2.w;
  358. float2 uv = float2(u, v);
  359. return uv;
  360. }
  361. float2 PS_P416_PQ_UV_709_2020(FragPos frag_in) : TARGET
  362. {
  363. float3 rgb = image.Load(int3(frag_in.pos.xy, 0)).rgb;
  364. rgb = rec709_to_rec2020(rgb);
  365. rgb = linear_to_st2084(rgb);
  366. float u = dot(color_vec1.xyz, rgb) + color_vec1.w;
  367. float v = dot(color_vec2.xyz, rgb) + color_vec2.w;
  368. float2 uv = float2(u, v);
  369. return uv;
  370. }
  371. float2 PS_P416_HLG_UV_709_2020(FragPos frag_in) : TARGET
  372. {
  373. float3 rgb = image.Load(int3(frag_in.pos.xy, 0)).rgb;
  374. rgb = rec709_to_rec2020(rgb);
  375. rgb = linear_to_hlg(rgb, hdr_lw);
  376. float u = dot(color_vec1.xyz, rgb) + color_vec1.w;
  377. float v = dot(color_vec2.xyz, rgb) + color_vec2.w;
  378. float2 uv = float2(u, v);
  379. return uv;
  380. }
  381. float2 PS_P416_SRGB_UV(FragPos frag_in) : TARGET
  382. {
  383. float3 rgb = image.Load(int3(frag_in.pos.xy, 0)).rgb;
  384. rgb = srgb_linear_to_nonlinear(rgb);
  385. float u = dot(color_vec1.xyz, rgb) + color_vec1.w;
  386. float v = dot(color_vec2.xyz, rgb) + color_vec2.w;
  387. float2 uv = float2(u, v);
  388. return uv;
  389. }
  390. float PS_U(FragPos frag_in) : TARGET
  391. {
  392. float3 rgb = image.Load(int3(frag_in.pos.xy, 0)).rgb;
  393. float u = dot(color_vec1.xyz, rgb) + color_vec1.w;
  394. return u;
  395. }
  396. float PS_V(FragPos frag_in) : TARGET
  397. {
  398. float3 rgb = image.Load(int3(frag_in.pos.xy, 0)).rgb;
  399. float v = dot(color_vec2.xyz, rgb) + color_vec2.w;
  400. return v;
  401. }
  402. float PS_U_Wide(FragTexWide frag_in) : TARGET
  403. {
  404. float3 rgb_left = image.Sample(def_sampler, frag_in.uuv.xz).rgb;
  405. float3 rgb_right = image.Sample(def_sampler, frag_in.uuv.yz).rgb;
  406. float3 rgb = (rgb_left + rgb_right) * 0.5;
  407. float u = dot(color_vec1.xyz, rgb) + color_vec1.w;
  408. return u;
  409. }
  410. float PS_V_Wide(FragTexWide frag_in) : TARGET
  411. {
  412. float3 rgb_left = image.Sample(def_sampler, frag_in.uuv.xz).rgb;
  413. float3 rgb_right = image.Sample(def_sampler, frag_in.uuv.yz).rgb;
  414. float3 rgb = (rgb_left + rgb_right) * 0.5;
  415. float v = dot(color_vec2.xyz, rgb) + color_vec2.w;
  416. return v;
  417. }
  418. float PS_I010_PQ_U_709_2020_WideWide(FragTexWideWide frag_in) : TARGET
  419. {
  420. float3 rgb_topleft = image.Sample(def_sampler, frag_in.uuvv.xz).rgb;
  421. float3 rgb_topright = image.Sample(def_sampler, frag_in.uuvv.yz).rgb;
  422. float3 rgb_bottomleft = image.Sample(def_sampler, frag_in.uuvv.xw).rgb;
  423. float3 rgb_bottomright = image.Sample(def_sampler, frag_in.uuvv.yw).rgb;
  424. float3 rgb = (rgb_topleft + rgb_topright + rgb_bottomleft + rgb_bottomright) * (0.25 * sdr_white_nits_over_maximum);
  425. rgb = rec709_to_rec2020(rgb);
  426. rgb = linear_to_st2084(rgb);
  427. float u = dot(color_vec1.xyz, rgb) + color_vec1.w;
  428. return u * (1023. / 65535.);
  429. }
  430. float PS_I010_HLG_U_709_2020_WideWide(FragTexWideWide frag_in) : TARGET
  431. {
  432. float3 rgb_topleft = image.Sample(def_sampler, frag_in.uuvv.xz).rgb;
  433. float3 rgb_topright = image.Sample(def_sampler, frag_in.uuvv.yz).rgb;
  434. float3 rgb_bottomleft = image.Sample(def_sampler, frag_in.uuvv.xw).rgb;
  435. float3 rgb_bottomright = image.Sample(def_sampler, frag_in.uuvv.yw).rgb;
  436. float3 rgb = (rgb_topleft + rgb_topright + rgb_bottomleft + rgb_bottomright) * (0.25 * sdr_white_nits_over_maximum);
  437. rgb = rec709_to_rec2020(rgb);
  438. rgb = linear_to_hlg(rgb, hdr_lw);
  439. float u = dot(color_vec1.xyz, rgb) + color_vec1.w;
  440. return u * (1023. / 65535.);
  441. }
  442. float PS_I010_SRGB_U_Wide(FragTexWide frag_in) : TARGET
  443. {
  444. float3 rgb_left = image.Sample(def_sampler, frag_in.uuv.xz).rgb;
  445. float3 rgb_right = image.Sample(def_sampler, frag_in.uuv.yz).rgb;
  446. float3 rgb = (rgb_left + rgb_right) * 0.5;
  447. rgb = srgb_linear_to_nonlinear(rgb);
  448. float u = dot(color_vec1.xyz, rgb) + color_vec1.w;
  449. return u * (1023. / 65535.);
  450. }
  451. float PS_I010_PQ_V_709_2020_WideWide(FragTexWideWide frag_in) : TARGET
  452. {
  453. float3 rgb_topleft = image.Sample(def_sampler, frag_in.uuvv.xz).rgb;
  454. float3 rgb_topright = image.Sample(def_sampler, frag_in.uuvv.yz).rgb;
  455. float3 rgb_bottomleft = image.Sample(def_sampler, frag_in.uuvv.xw).rgb;
  456. float3 rgb_bottomright = image.Sample(def_sampler, frag_in.uuvv.yw).rgb;
  457. float3 rgb = (rgb_topleft + rgb_topright + rgb_bottomleft + rgb_bottomright) * (0.25 * sdr_white_nits_over_maximum);
  458. rgb = rec709_to_rec2020(rgb);
  459. rgb = linear_to_st2084(rgb);
  460. float v = dot(color_vec2.xyz, rgb) + color_vec2.w;
  461. return v * (1023. / 65535.);
  462. }
  463. float PS_I010_HLG_V_709_2020_WideWide(FragTexWideWide frag_in) : TARGET
  464. {
  465. float3 rgb_topleft = image.Sample(def_sampler, frag_in.uuvv.xz).rgb;
  466. float3 rgb_topright = image.Sample(def_sampler, frag_in.uuvv.yz).rgb;
  467. float3 rgb_bottomleft = image.Sample(def_sampler, frag_in.uuvv.xw).rgb;
  468. float3 rgb_bottomright = image.Sample(def_sampler, frag_in.uuvv.yw).rgb;
  469. float3 rgb = (rgb_topleft + rgb_topright + rgb_bottomleft + rgb_bottomright) * (0.25 * sdr_white_nits_over_maximum);
  470. rgb = rec709_to_rec2020(rgb);
  471. rgb = linear_to_hlg(rgb, hdr_lw);
  472. float v = dot(color_vec2.xyz, rgb) + color_vec2.w;
  473. return v * (1023. / 65535.);
  474. }
  475. float PS_I010_SRGB_V_Wide(FragTexWide frag_in) : TARGET
  476. {
  477. float3 rgb_left = image.Sample(def_sampler, frag_in.uuv.xz).rgb;
  478. float3 rgb_right = image.Sample(def_sampler, frag_in.uuv.yz).rgb;
  479. float3 rgb = (rgb_left + rgb_right) * 0.5;
  480. rgb = srgb_linear_to_nonlinear(rgb);
  481. float v = dot(color_vec2.xyz, rgb) + color_vec2.w;
  482. return v * (1023. / 65535.);
  483. }
  484. float3 YUV_to_RGB(float3 yuv)
  485. {
  486. yuv = clamp(yuv, color_range_min, color_range_max);
  487. float r = dot(color_vec0.xyz, yuv) + color_vec0.w;
  488. float g = dot(color_vec1.xyz, yuv) + color_vec1.w;
  489. float b = dot(color_vec2.xyz, yuv) + color_vec2.w;
  490. return float3(r, g, b);
  491. }
  492. float3 PSUYVY_Reverse(FragTexTex frag_in) : TARGET
  493. {
  494. float2 y01 = image.Load(int3(frag_in.uvuv.xy, 0)).yw;
  495. float2 cbcr = image.Sample(def_sampler, frag_in.uvuv.zw, 0).zx;
  496. float leftover = frac(frag_in.uvuv.x);
  497. float y = (leftover < 0.5) ? y01.x : y01.y;
  498. float3 yuv = float3(y, cbcr);
  499. float3 rgb = YUV_to_RGB(yuv);
  500. return rgb;
  501. }
  502. float3 PSYUY2_Reverse(FragTexTex frag_in) : TARGET
  503. {
  504. float2 y01 = image.Load(int3(frag_in.uvuv.xy, 0)).zx;
  505. float2 cbcr = image.Sample(def_sampler, frag_in.uvuv.zw, 0).yw;
  506. float leftover = frac(frag_in.uvuv.x);
  507. float y = (leftover < 0.5) ? y01.x : y01.y;
  508. float3 yuv = float3(y, cbcr);
  509. float3 rgb = YUV_to_RGB(yuv);
  510. return rgb;
  511. }
  512. float4 PSYUY2_PQ_Reverse(FragTexTex frag_in) : TARGET
  513. {
  514. float2 y01 = image.Load(int3(frag_in.uvuv.xy, 0)).zx;
  515. float2 cbcr = image.Sample(def_sampler, frag_in.uvuv.zw, 0).yw;
  516. float leftover = frac(frag_in.uvuv.x);
  517. float y = (leftover < 0.5) ? y01.x : y01.y;
  518. float3 yuv = float3(y, cbcr);
  519. float3 pq = YUV_to_RGB(yuv);
  520. float3 hdr2020 = st2084_to_linear_eetf(pq, hdr_lw, hdr_lmax) * maximum_over_sdr_white_nits;
  521. float3 rgb = rec2020_to_rec709(hdr2020);
  522. return float4(rgb, 1.);
  523. }
  524. float4 PSYUY2_HLG_Reverse(FragTexTex frag_in) : TARGET
  525. {
  526. float2 y01 = image.Load(int3(frag_in.uvuv.xy, 0)).zx;
  527. float2 cbcr = image.Sample(def_sampler, frag_in.uvuv.zw, 0).yw;
  528. float leftover = frac(frag_in.uvuv.x);
  529. float y = (leftover < 0.5) ? y01.x : y01.y;
  530. float3 yuv = float3(y, cbcr);
  531. float3 hlg = YUV_to_RGB(yuv);
  532. float3 hdr2020 = hlg_to_linear(hlg, hlg_exponent) * maximum_over_sdr_white_nits;
  533. float3 rgb = rec2020_to_rec709(hdr2020);
  534. return float4(rgb, 1.);
  535. }
  536. float3 PSYVYU_Reverse(FragTexTex frag_in) : TARGET
  537. {
  538. float2 y01 = image.Load(int3(frag_in.uvuv.xy, 0)).zx;
  539. float2 cbcr = image.Sample(def_sampler, frag_in.uvuv.zw, 0).wy;
  540. float leftover = frac(frag_in.uvuv.x);
  541. float y = (leftover < 0.5) ? y01.x : y01.y;
  542. float3 yuv = float3(y, cbcr);
  543. float3 rgb = YUV_to_RGB(yuv);
  544. return rgb;
  545. }
  546. float3 PSPlanar420_Reverse(VertTexPos frag_in) : TARGET
  547. {
  548. float y = image.Load(int3(frag_in.pos.xy, 0)).x;
  549. float cb = image1.Sample(def_sampler, frag_in.uv).x;
  550. float cr = image2.Sample(def_sampler, frag_in.uv).x;
  551. float3 yuv = float3(y, cb, cr);
  552. float3 rgb = YUV_to_RGB(yuv);
  553. return rgb;
  554. }
  555. float4 PSPlanar420_PQ_Reverse(VertTexPos frag_in) : TARGET
  556. {
  557. float y = image.Load(int3(frag_in.pos.xy, 0)).x;
  558. float cb = image1.Sample(def_sampler, frag_in.uv).x;
  559. float cr = image2.Sample(def_sampler, frag_in.uv).x;
  560. float3 yuv = float3(y, cb, cr);
  561. float3 pq = YUV_to_RGB(yuv);
  562. float3 hdr2020 = st2084_to_linear_eetf(pq, hdr_lw, hdr_lmax) * maximum_over_sdr_white_nits;
  563. float3 rgb = rec2020_to_rec709(hdr2020);
  564. return float4(rgb, 1.);
  565. }
  566. float4 PSPlanar420_HLG_Reverse(VertTexPos frag_in) : TARGET
  567. {
  568. float y = image.Load(int3(frag_in.pos.xy, 0)).x;
  569. float cb = image1.Sample(def_sampler, frag_in.uv).x;
  570. float cr = image2.Sample(def_sampler, frag_in.uv).x;
  571. float3 yuv = float3(y, cb, cr);
  572. float3 hlg = YUV_to_RGB(yuv);
  573. float3 hdr2020 = hlg_to_linear(hlg, hlg_exponent) * maximum_over_sdr_white_nits;
  574. float3 rgb = rec2020_to_rec709(hdr2020);
  575. return float4(rgb, 1.);
  576. }
  577. float4 PSPlanar420A_Reverse(VertTexPos frag_in) : TARGET
  578. {
  579. int3 xy0_luma = int3(frag_in.pos.xy, 0);
  580. float y = image.Load(xy0_luma).x;
  581. float alpha = image3.Load(xy0_luma).x;
  582. float cb = image1.Sample(def_sampler, frag_in.uv).x;
  583. float cr = image2.Sample(def_sampler, frag_in.uv).x;
  584. float3 yuv = float3(y, cb, cr);
  585. float4 rgba = float4(YUV_to_RGB(yuv), alpha);
  586. return rgba;
  587. }
  588. float3 PSPlanar422_Reverse(VertTexPos frag_in) : TARGET
  589. {
  590. float y = image.Load(int3(frag_in.pos.xy, 0)).x;
  591. float cb = image1.Sample(def_sampler, frag_in.uv).x;
  592. float cr = image2.Sample(def_sampler, frag_in.uv).x;
  593. float3 yuv = float3(y, cb, cr);
  594. float3 rgb = YUV_to_RGB(yuv);
  595. return rgb;
  596. }
  597. float4 PSPlanar422_10LE_Reverse(VertTexPos frag_in) : TARGET
  598. {
  599. float y = image.Load(int3(frag_in.pos.xy, 0)).x;
  600. float cb = image1.Sample(def_sampler, frag_in.uv).x;
  601. float cr = image2.Sample(def_sampler, frag_in.uv).x;
  602. float3 yuv = float3(y, cb, cr);
  603. yuv *= 65535. / 1023.;
  604. float3 rgb = YUV_to_RGB(yuv);
  605. rgb = srgb_nonlinear_to_linear(rgb);
  606. return float4(rgb, 1.);
  607. }
  608. float4 PSPlanar422_10LE_PQ_Reverse(VertTexPos frag_in) : TARGET
  609. {
  610. float y = image.Load(int3(frag_in.pos.xy, 0)).x;
  611. float cb = image1.Sample(def_sampler, frag_in.uv).x;
  612. float cr = image2.Sample(def_sampler, frag_in.uv).x;
  613. float3 yuv = float3(y, cb, cr);
  614. yuv *= 65535. / 1023.;
  615. float3 pq = YUV_to_RGB(yuv);
  616. float3 hdr2020 = st2084_to_linear_eetf(pq, hdr_lw, hdr_lmax) * maximum_over_sdr_white_nits;
  617. float3 rgb = rec2020_to_rec709(hdr2020);
  618. return float4(rgb, 1.);
  619. }
  620. float4 PSPlanar422_10LE_HLG_Reverse(VertTexPos frag_in) : TARGET
  621. {
  622. float y = image.Load(int3(frag_in.pos.xy, 0)).x;
  623. float cb = image1.Sample(def_sampler, frag_in.uv).x;
  624. float cr = image2.Sample(def_sampler, frag_in.uv).x;
  625. float3 yuv = float3(y, cb, cr);
  626. yuv *= 65535. / 1023.;
  627. float3 hlg = YUV_to_RGB(yuv);
  628. float3 hdr2020 = hlg_to_linear(hlg, hlg_exponent) * maximum_over_sdr_white_nits;
  629. float3 rgb = rec2020_to_rec709(hdr2020);
  630. return float4(rgb, 1.);
  631. }
  632. float4 PSPlanar422A_Reverse(VertTexPos frag_in) : TARGET
  633. {
  634. int3 xy0_luma = int3(frag_in.pos.xy, 0);
  635. float y = image.Load(xy0_luma).x;
  636. float alpha = image3.Load(xy0_luma).x;
  637. float cb = image1.Sample(def_sampler, frag_in.uv).x;
  638. float cr = image2.Sample(def_sampler, frag_in.uv).x;
  639. float3 yuv = float3(y, cb, cr);
  640. float4 rgba = float4(YUV_to_RGB(yuv), alpha);
  641. return rgba;
  642. }
  643. float3 PSPlanar444_Reverse(FragPos frag_in) : TARGET
  644. {
  645. int3 xy0 = int3(frag_in.pos.xy, 0);
  646. float y = image.Load(xy0).x;
  647. float cb = image1.Load(xy0).x;
  648. float cr = image2.Load(xy0).x;
  649. float3 yuv = float3(y, cb, cr);
  650. float3 rgb = YUV_to_RGB(yuv);
  651. return rgb;
  652. }
  653. float4 PSPlanar444_12LE_Reverse(FragPos frag_in) : TARGET
  654. {
  655. int3 xy0 = int3(frag_in.pos.xy, 0);
  656. float y = image.Load(xy0).x;
  657. float cb = image1.Load(xy0).x;
  658. float cr = image2.Load(xy0).x;
  659. float3 yuv = float3(y, cb, cr);
  660. yuv *= 65535. / 4095.;
  661. float3 rgb = YUV_to_RGB(yuv);
  662. rgb = srgb_nonlinear_to_linear(rgb);
  663. return float4(rgb, 1.);
  664. }
  665. float4 PSPlanar444_12LE_PQ_Reverse(FragPos frag_in) : TARGET
  666. {
  667. int3 xy0 = int3(frag_in.pos.xy, 0);
  668. float y = image.Load(xy0).x;
  669. float cb = image1.Load(xy0).x;
  670. float cr = image2.Load(xy0).x;
  671. float3 yuv = float3(y, cb, cr);
  672. yuv *= 65535. / 4095;
  673. float3 pq = YUV_to_RGB(yuv);
  674. float3 hdr2020 = st2084_to_linear_eetf(pq, hdr_lw, hdr_lmax) * maximum_over_sdr_white_nits;
  675. float3 rgb = rec2020_to_rec709(hdr2020);
  676. return float4(rgb, 1.);
  677. }
  678. float4 PSPlanar444_12LE_HLG_Reverse(FragPos frag_in) : TARGET
  679. {
  680. int3 xy0 = int3(frag_in.pos.xy, 0);
  681. float y = image.Load(xy0).x;
  682. float cb = image1.Load(xy0).x;
  683. float cr = image2.Load(xy0).x;
  684. float3 yuv = float3(y, cb, cr);
  685. yuv *= 65535. / 4095;
  686. float3 hlg = YUV_to_RGB(yuv);
  687. float3 hdr2020 = hlg_to_linear(hlg, hlg_exponent) * maximum_over_sdr_white_nits;
  688. float3 rgb = rec2020_to_rec709(hdr2020);
  689. return float4(rgb, 1.);
  690. }
  691. float4 PSPlanar444A_Reverse(FragPos frag_in) : TARGET
  692. {
  693. int3 xy0 = int3(frag_in.pos.xy, 0);
  694. float y = image.Load(xy0).x;
  695. float cb = image1.Load(xy0).x;
  696. float cr = image2.Load(xy0).x;
  697. float alpha = image3.Load(xy0).x;
  698. float3 yuv = float3(y, cb, cr);
  699. float4 rgba = float4(YUV_to_RGB(yuv), alpha);
  700. return rgba;
  701. }
  702. float4 PSPlanar444A_12LE_Reverse(FragPos frag_in) : TARGET
  703. {
  704. int3 xy0 = int3(frag_in.pos.xy, 0);
  705. float y = image.Load(xy0).x;
  706. float cb = image1.Load(xy0).x;
  707. float cr = image2.Load(xy0).x;
  708. float alpha = image3.Load(xy0).x * 16.;
  709. float3 yuv = float3(y, cb, cr);
  710. yuv *= 65535. / 4095.;
  711. float3 rgb = YUV_to_RGB(yuv);
  712. rgb = srgb_nonlinear_to_linear(rgb);
  713. return float4(rgb, alpha);
  714. }
  715. float4 PSAYUV_Reverse(FragPos frag_in) : TARGET
  716. {
  717. float4 yuva = image.Load(int3(frag_in.pos.xy, 0));
  718. float4 rgba = float4(YUV_to_RGB(yuva.xyz), yuva.a);
  719. return rgba;
  720. }
  721. float3 PSNV12_Reverse(VertTexPos frag_in) : TARGET
  722. {
  723. float y = image.Load(int3(frag_in.pos.xy, 0)).x;
  724. float2 cbcr = image1.Sample(def_sampler, frag_in.uv).xy;
  725. float3 yuv = float3(y, cbcr);
  726. float3 rgb = YUV_to_RGB(yuv);
  727. return rgb;
  728. }
  729. float4 PSNV12_PQ_Reverse(VertTexPos frag_in) : TARGET
  730. {
  731. float y = image.Load(int3(frag_in.pos.xy, 0)).x;
  732. float2 cbcr = image1.Sample(def_sampler, frag_in.uv).xy;
  733. float3 yuv = float3(y, cbcr);
  734. float3 pq = YUV_to_RGB(yuv);
  735. float3 hdr2020 = st2084_to_linear_eetf(pq, hdr_lw, hdr_lmax) * maximum_over_sdr_white_nits;
  736. float3 rgb = rec2020_to_rec709(hdr2020);
  737. return float4(rgb, 1.);
  738. }
  739. float4 PSNV12_HLG_Reverse(VertTexPos frag_in) : TARGET
  740. {
  741. float y = image.Load(int3(frag_in.pos.xy, 0)).x;
  742. float2 cbcr = image1.Sample(def_sampler, frag_in.uv).xy;
  743. float3 yuv = float3(y, cbcr);
  744. float3 hlg = YUV_to_RGB(yuv);
  745. float3 hdr2020 = hlg_to_linear(hlg, hlg_exponent) * maximum_over_sdr_white_nits;
  746. float3 rgb = rec2020_to_rec709(hdr2020);
  747. return float4(rgb, 1.);
  748. }
  749. float4 PSI010_SRGB_Reverse(VertTexPos frag_in) : TARGET
  750. {
  751. float ratio = 65535. / 1023.;
  752. float y = image.Load(int3(frag_in.pos.xy, 0)).x * ratio;
  753. float cb = image1.Sample(def_sampler, frag_in.uv).x * ratio;
  754. float cr = image2.Sample(def_sampler, frag_in.uv).x * ratio;
  755. float3 yuv = float3(y, cb, cr);
  756. float3 rgb = YUV_to_RGB(yuv);
  757. rgb = srgb_nonlinear_to_linear(rgb);
  758. return float4(rgb, 1.);
  759. }
  760. float4 PSI010_PQ_2020_709_Reverse(VertTexPos frag_in) : TARGET
  761. {
  762. float ratio = 65535. / 1023.;
  763. float y = image.Load(int3(frag_in.pos.xy, 0)).x * ratio;
  764. float cb = image1.Sample(def_sampler, frag_in.uv).x * ratio;
  765. float cr = image2.Sample(def_sampler, frag_in.uv).x * ratio;
  766. float3 yuv = float3(y, cb, cr);
  767. float3 pq = YUV_to_RGB(yuv);
  768. float3 hdr2020 = st2084_to_linear_eetf(pq, hdr_lw, hdr_lmax) * maximum_over_sdr_white_nits;
  769. float3 rgb = rec2020_to_rec709(hdr2020);
  770. return float4(rgb, 1.);
  771. }
  772. float4 PSI010_HLG_2020_709_Reverse(VertTexPos frag_in) : TARGET
  773. {
  774. float ratio = 65535. / 1023.;
  775. float y = image.Load(int3(frag_in.pos.xy, 0)).x * ratio;
  776. float cb = image1.Sample(def_sampler, frag_in.uv).x * ratio;
  777. float cr = image2.Sample(def_sampler, frag_in.uv).x * ratio;
  778. float3 yuv = float3(y, cb, cr);
  779. float3 hlg = YUV_to_RGB(yuv);
  780. float3 hdr2020 = hlg_to_linear(hlg, hlg_exponent) * maximum_over_sdr_white_nits;
  781. float3 rgb = rec2020_to_rec709(hdr2020);
  782. return float4(rgb, 1.);
  783. }
  784. float4 PSP010_SRGB_Reverse(VertTexPos frag_in) : TARGET
  785. {
  786. float y = image.Load(int3(frag_in.pos.xy, 0)).x;
  787. float2 cbcr = image1.Sample(def_sampler, frag_in.uv).xy;
  788. float3 yuv_65535 = floor(float3(y, cbcr) * 65535. + 0.5);
  789. float3 yuv_1023 = floor(yuv_65535 * 0.015625);
  790. float3 yuv = yuv_1023 / 1023.;
  791. float3 rgb = YUV_to_RGB(yuv);
  792. rgb = srgb_nonlinear_to_linear(rgb);
  793. return float4(rgb, 1.);
  794. }
  795. float4 PSP010_PQ_2020_709_Reverse(VertTexPos frag_in) : TARGET
  796. {
  797. float y = image.Load(int3(frag_in.pos.xy, 0)).x;
  798. float2 cbcr = image1.Sample(def_sampler, frag_in.uv).xy;
  799. float3 yuv_65535 = floor(float3(y, cbcr) * 65535. + 0.5);
  800. float3 yuv_1023 = floor(yuv_65535 * 0.015625);
  801. float3 yuv = yuv_1023 / 1023.;
  802. float3 pq = YUV_to_RGB(yuv);
  803. float3 hdr2020 = st2084_to_linear_eetf(pq, hdr_lw, hdr_lmax) * maximum_over_sdr_white_nits;
  804. float3 rgb = rec2020_to_rec709(hdr2020);
  805. return float4(rgb, 1.);
  806. }
  807. float4 PSP010_HLG_2020_709_Reverse(VertTexPos frag_in) : TARGET
  808. {
  809. float y = image.Load(int3(frag_in.pos.xy, 0)).x;
  810. float2 cbcr = image1.Sample(def_sampler, frag_in.uv).xy;
  811. float3 yuv_65535 = floor(float3(y, cbcr) * 65535. + 0.5);
  812. float3 yuv_1023 = floor(yuv_65535 * 0.015625);
  813. float3 yuv = yuv_1023 / 1023.;
  814. float3 hlg = YUV_to_RGB(yuv);
  815. float3 hdr2020 = hlg_to_linear(hlg, hlg_exponent) * maximum_over_sdr_white_nits;
  816. float3 rgb = rec2020_to_rec709(hdr2020);
  817. return float4(rgb, 1.);
  818. }
  819. float3 compute_v210_reverse(float2 pos)
  820. {
  821. uint x = uint(pos.x);
  822. uint packed_x = x % 6u;
  823. uint base_x = x / 6u * 4u;
  824. float y, cb, cr;
  825. if (packed_x == 0u)
  826. {
  827. float3 word0_rgb = image.Load(int3(base_x, pos.y, 0)).rgb;
  828. y = word0_rgb.y;
  829. cb = word0_rgb.x;
  830. cr = word0_rgb.z;
  831. }
  832. else if (packed_x == 1u)
  833. {
  834. float2 word0_rb = image.Load(int3(base_x, pos.y, 0)).rb;
  835. float2 word1_rg = image.Load(int3(base_x + 1u, pos.y, 0)).rg;
  836. y = word1_rg.x;
  837. cb = (word0_rb.x + word1_rg.y) * 0.5;
  838. cr = (word0_rb.y + image.Load(int3(base_x + 2u, pos.y, 0)).r) * 0.5;
  839. }
  840. else if (packed_x == 2u)
  841. {
  842. float2 word1_gb = image.Load(int3(base_x + 1u, pos.y, 0)).gb;
  843. y = word1_gb.y;
  844. cb = word1_gb.x;
  845. cr = image.Load(int3(base_x + 2u, pos.y, 0)).r;
  846. }
  847. else if (packed_x == 3u)
  848. {
  849. float2 word2_rb = image.Load(int3(base_x + 2u, pos.y, 0)).rb;
  850. y = image.Load(int3(base_x + 2u, pos.y, 0)).g;
  851. cb = (image.Load(int3(base_x + 1u, pos.y, 0)).g + word2_rb.y) * 0.5;
  852. cr = (word2_rb.x + image.Load(int3(base_x + 3u, pos.y, 0)).g) * 0.5;
  853. }
  854. else if (packed_x == 4u)
  855. {
  856. float2 word3_rg = image.Load(int3(base_x + 3u, pos.y, 0)).rg;
  857. y = word3_rg.x;
  858. cb = image.Load(int3(base_x + 2u, pos.y, 0)).b;
  859. cr = word3_rg.y;
  860. }
  861. else
  862. {
  863. float2 word3_gb = image.Load(int3(base_x + 3u, pos.y, 0)).gb;
  864. y = word3_gb.y;
  865. cb = image.Load(int3(base_x + 2u, pos.y, 0)).b;
  866. cr = word3_gb.x;
  867. uint base_x_4 = base_x + 4u;
  868. if ((pos.x + 1.) < width)
  869. {
  870. float2 word4_gb = image.Load(int3(base_x + 4u, pos.y, 0)).rb;
  871. cb = (cb + word4_gb.x) * 0.5;
  872. cr = (cr + word4_gb.y) * 0.5;
  873. }
  874. }
  875. float3 yuv_65535 = floor(float3(y, cb, cr) * 65535. + 0.5);
  876. float3 yuv_1023 = floor(yuv_65535 * 0.015625);
  877. float3 yuv = yuv_1023 / 1023.;
  878. float3 rgb = YUV_to_RGB(yuv);
  879. return rgb;
  880. }
  881. float4 PSV210_SRGB_Reverse(FragPos frag_in) : TARGET
  882. {
  883. float3 rgb = compute_v210_reverse(frag_in.pos.xy);
  884. rgb = srgb_nonlinear_to_linear(rgb);
  885. return float4(rgb, 1.);
  886. }
  887. float4 PSV210_PQ_2020_709_Reverse(FragPos frag_in) : TARGET
  888. {
  889. float3 pq = compute_v210_reverse(frag_in.pos.xy);
  890. float3 hdr2020 = st2084_to_linear_eetf(pq, hdr_lw, hdr_lmax) * maximum_over_sdr_white_nits;
  891. float3 rgb = rec2020_to_rec709(hdr2020);
  892. return float4(rgb, 1.);
  893. }
  894. float4 PSV210_HLG_2020_709_Reverse(FragPos frag_in) : TARGET
  895. {
  896. float3 hlg = compute_v210_reverse(frag_in.pos.xy);
  897. float3 hdr2020 = hlg_to_linear(hlg, hlg_exponent) * maximum_over_sdr_white_nits;
  898. float3 rgb = rec2020_to_rec709(hdr2020);
  899. return float4(rgb, 1.);
  900. }
  901. float3 PSY800_Limited(FragPos frag_in) : TARGET
  902. {
  903. float limited = image.Load(int3(frag_in.pos.xy, 0)).x;
  904. float full = (255.0 / 219.0) * limited - (16.0 / 219.0);
  905. return float3(full, full, full);
  906. }
  907. float3 PSY800_Full(FragPos frag_in) : TARGET
  908. {
  909. float3 full = image.Load(int3(frag_in.pos.xy, 0)).xxx;
  910. return full;
  911. }
  912. float4 PSRGB_Limited(FragPos frag_in) : TARGET
  913. {
  914. float4 rgba = image.Load(int3(frag_in.pos.xy, 0));
  915. rgba.rgb = (255.0 / 219.0) * rgba.rgb - (16.0 / 219.0);
  916. return rgba;
  917. }
  918. float3 PSBGR3_Limited(FragPos frag_in) : TARGET
  919. {
  920. float x = frag_in.pos.x * 3.0;
  921. float y = frag_in.pos.y;
  922. float b = image.Load(int3(x - 1.0, y, 0)).x;
  923. float g = image.Load(int3(x, y, 0)).x;
  924. float r = image.Load(int3(x + 1.0, y, 0)).x;
  925. float3 rgb = float3(r, g, b);
  926. rgb = (255.0 / 219.0) * rgb - (16.0 / 219.0);
  927. return rgb;
  928. }
  929. float3 PSBGR3_Full(FragPos frag_in) : TARGET
  930. {
  931. float x = frag_in.pos.x * 3.0;
  932. float y = frag_in.pos.y;
  933. float b = image.Load(int3(x - 1.0, y, 0)).x;
  934. float g = image.Load(int3(x, y, 0)).x;
  935. float r = image.Load(int3(x + 1.0, y, 0)).x;
  936. float3 rgb = float3(r, g, b);
  937. return rgb;
  938. }
  939. float3 compute_r10l_reverse(float2 pos, bool limited)
  940. {
  941. float4 xyzw = image.Load(int3(pos, 0)).bgra;
  942. uint4 xyzw255 = uint4(mad(xyzw, 255., 0.5));
  943. uint r = ((xyzw255.z & 0xC0u) >> 6) | (xyzw255.w << 2);
  944. uint g = ((xyzw255.y & 0xFu) >> 4) | ((xyzw255.z & 0x3Fu) << 4);
  945. uint b = (xyzw255.x >> 2) | ((xyzw255.y & 0xFu) << 6);
  946. float3 rgb = float3(uint3(r, g, b));
  947. if (limited)
  948. {
  949. rgb = mad(rgb, 1. / 876., -16. / 219.);
  950. }
  951. else
  952. {
  953. rgb /= 1023.;
  954. }
  955. return rgb;
  956. }
  957. float4 PSR10L_SRGB_Full_Reverse(FragPos frag_in) : TARGET
  958. {
  959. float3 rgb = compute_r10l_reverse(frag_in.pos.xy, false);
  960. rgb = srgb_nonlinear_to_linear(rgb);
  961. return float4(rgb, 1.);
  962. }
  963. float4 PSR10L_PQ_2020_709_Full_Reverse(FragPos frag_in) : TARGET
  964. {
  965. float3 pq = compute_r10l_reverse(frag_in.pos.xy, false);
  966. float3 hdr2020 = st2084_to_linear_eetf(pq, hdr_lw, hdr_lmax) * maximum_over_sdr_white_nits;
  967. float3 rgb = rec2020_to_rec709(hdr2020);
  968. return float4(rgb, 1.);
  969. }
  970. float4 PSR10L_HLG_2020_709_Full_Reverse(FragPos frag_in) : TARGET
  971. {
  972. float3 hlg = compute_r10l_reverse(frag_in.pos.xy, false);
  973. float3 hdr2020 = hlg_to_linear(hlg, hlg_exponent) * maximum_over_sdr_white_nits;
  974. float3 rgb = rec2020_to_rec709(hdr2020);
  975. return float4(rgb, 1.);
  976. }
  977. float4 PSR10L_SRGB_Limited_Reverse(FragPos frag_in) : TARGET
  978. {
  979. float3 rgb = compute_r10l_reverse(frag_in.pos.xy, true);
  980. rgb = srgb_nonlinear_to_linear(rgb);
  981. return float4(rgb, 1.);
  982. }
  983. float4 PSR10L_PQ_2020_709_Limited_Reverse(FragPos frag_in) : TARGET
  984. {
  985. float3 pq = compute_r10l_reverse(frag_in.pos.xy, true);
  986. float3 hdr2020 = st2084_to_linear_eetf(pq, hdr_lw, hdr_lmax) * maximum_over_sdr_white_nits;
  987. float3 rgb = rec2020_to_rec709(hdr2020);
  988. return float4(rgb, 1.);
  989. }
  990. float4 PSR10L_HLG_2020_709_Limited_Reverse(FragPos frag_in) : TARGET
  991. {
  992. float3 hlg = compute_r10l_reverse(frag_in.pos.xy, true);
  993. float3 hdr2020 = hlg_to_linear(hlg, hlg_exponent) * maximum_over_sdr_white_nits;
  994. float3 rgb = rec2020_to_rec709(hdr2020);
  995. return float4(rgb, 1.);
  996. }
  997. technique Planar_Y
  998. {
  999. pass
  1000. {
  1001. vertex_shader = VSPos(id);
  1002. pixel_shader = PS_Y(frag_in);
  1003. }
  1004. }
  1005. technique Planar_U
  1006. {
  1007. pass
  1008. {
  1009. vertex_shader = VSPos(id);
  1010. pixel_shader = PS_U(frag_in);
  1011. }
  1012. }
  1013. technique Planar_V
  1014. {
  1015. pass
  1016. {
  1017. vertex_shader = VSPos(id);
  1018. pixel_shader = PS_V(frag_in);
  1019. }
  1020. }
  1021. technique Planar_U_Left
  1022. {
  1023. pass
  1024. {
  1025. vertex_shader = VSTexPos_Left(id);
  1026. pixel_shader = PS_U_Wide(frag_in);
  1027. }
  1028. }
  1029. technique Planar_V_Left
  1030. {
  1031. pass
  1032. {
  1033. vertex_shader = VSTexPos_Left(id);
  1034. pixel_shader = PS_V_Wide(frag_in);
  1035. }
  1036. }
  1037. technique NV12_Y
  1038. {
  1039. pass
  1040. {
  1041. vertex_shader = VSPos(id);
  1042. pixel_shader = PS_Y(frag_in);
  1043. }
  1044. }
  1045. technique NV12_UV
  1046. {
  1047. pass
  1048. {
  1049. vertex_shader = VSTexPos_Left(id);
  1050. pixel_shader = PS_UV_Wide(frag_in);
  1051. }
  1052. }
  1053. technique I010_PQ_Y
  1054. {
  1055. pass
  1056. {
  1057. vertex_shader = VSPos(id);
  1058. pixel_shader = PS_I010_PQ_Y_709_2020(frag_in);
  1059. }
  1060. }
  1061. technique I010_HLG_Y
  1062. {
  1063. pass
  1064. {
  1065. vertex_shader = VSPos(id);
  1066. pixel_shader = PS_I010_HLG_Y_709_2020(frag_in);
  1067. }
  1068. }
  1069. technique I010_SRGB_Y
  1070. {
  1071. pass
  1072. {
  1073. vertex_shader = VSPos(id);
  1074. pixel_shader = PS_I010_SRGB_Y(frag_in);
  1075. }
  1076. }
  1077. technique I010_PQ_U
  1078. {
  1079. pass
  1080. {
  1081. vertex_shader = VSTexPos_TopLeft(id);
  1082. pixel_shader = PS_I010_PQ_U_709_2020_WideWide(frag_in);
  1083. }
  1084. }
  1085. technique I010_HLG_U
  1086. {
  1087. pass
  1088. {
  1089. vertex_shader = VSTexPos_TopLeft(id);
  1090. pixel_shader = PS_I010_HLG_U_709_2020_WideWide(frag_in);
  1091. }
  1092. }
  1093. technique I010_SRGB_U
  1094. {
  1095. pass
  1096. {
  1097. vertex_shader = VSTexPos_Left(id);
  1098. pixel_shader = PS_I010_SRGB_U_Wide(frag_in);
  1099. }
  1100. }
  1101. technique I010_PQ_V
  1102. {
  1103. pass
  1104. {
  1105. vertex_shader = VSTexPos_TopLeft(id);
  1106. pixel_shader = PS_I010_PQ_V_709_2020_WideWide(frag_in);
  1107. }
  1108. }
  1109. technique I010_HLG_V
  1110. {
  1111. pass
  1112. {
  1113. vertex_shader = VSTexPos_TopLeft(id);
  1114. pixel_shader = PS_I010_HLG_V_709_2020_WideWide(frag_in);
  1115. }
  1116. }
  1117. technique I010_SRGB_V
  1118. {
  1119. pass
  1120. {
  1121. vertex_shader = VSTexPos_Left(id);
  1122. pixel_shader = PS_I010_SRGB_V_Wide(frag_in);
  1123. }
  1124. }
  1125. technique P010_PQ_Y
  1126. {
  1127. pass
  1128. {
  1129. vertex_shader = VSPos(id);
  1130. pixel_shader = PS_P010_PQ_Y_709_2020(frag_in);
  1131. }
  1132. }
  1133. technique P010_HLG_Y
  1134. {
  1135. pass
  1136. {
  1137. vertex_shader = VSPos(id);
  1138. pixel_shader = PS_P010_HLG_Y_709_2020(frag_in);
  1139. }
  1140. }
  1141. technique P010_SRGB_Y
  1142. {
  1143. pass
  1144. {
  1145. vertex_shader = VSPos(id);
  1146. pixel_shader = PS_P010_SRGB_Y(frag_in);
  1147. }
  1148. }
  1149. technique P010_PQ_UV
  1150. {
  1151. pass
  1152. {
  1153. vertex_shader = VSTexPos_TopLeft(id);
  1154. pixel_shader = PS_P010_PQ_UV_709_2020_WideWide(frag_in);
  1155. }
  1156. }
  1157. technique P010_HLG_UV
  1158. {
  1159. pass
  1160. {
  1161. vertex_shader = VSTexPos_TopLeft(id);
  1162. pixel_shader = PS_P010_HLG_UV_709_2020_WideWide(frag_in);
  1163. }
  1164. }
  1165. technique P010_SRGB_UV
  1166. {
  1167. pass
  1168. {
  1169. vertex_shader = VSTexPos_Left(id);
  1170. pixel_shader = PS_P010_SRGB_UV_Wide(frag_in);
  1171. }
  1172. }
  1173. technique P216_PQ_Y
  1174. {
  1175. pass
  1176. {
  1177. vertex_shader = VSPos(id);
  1178. pixel_shader = PS_P216_PQ_Y_709_2020(frag_in);
  1179. }
  1180. }
  1181. technique P216_HLG_Y
  1182. {
  1183. pass
  1184. {
  1185. vertex_shader = VSPos(id);
  1186. pixel_shader = PS_P216_HLG_Y_709_2020(frag_in);
  1187. }
  1188. }
  1189. technique P216_SRGB_Y
  1190. {
  1191. pass
  1192. {
  1193. vertex_shader = VSPos(id);
  1194. pixel_shader = PS_P216_SRGB_Y(frag_in);
  1195. }
  1196. }
  1197. technique P216_PQ_UV
  1198. {
  1199. pass
  1200. {
  1201. vertex_shader = VSTexPos_Left(id);
  1202. pixel_shader = PS_P216_PQ_UV_709_2020_Wide(frag_in);
  1203. }
  1204. }
  1205. technique P216_HLG_UV
  1206. {
  1207. pass
  1208. {
  1209. vertex_shader = VSTexPos_Left(id);
  1210. pixel_shader = PS_P216_HLG_UV_709_2020_Wide(frag_in);
  1211. }
  1212. }
  1213. technique P216_SRGB_UV
  1214. {
  1215. pass
  1216. {
  1217. vertex_shader = VSTexPos_Left(id);
  1218. pixel_shader = PS_P216_SRGB_UV_Wide(frag_in);
  1219. }
  1220. }
  1221. technique P416_PQ_Y
  1222. {
  1223. pass
  1224. {
  1225. vertex_shader = VSPos(id);
  1226. pixel_shader = PS_P416_PQ_Y_709_2020(frag_in);
  1227. }
  1228. }
  1229. technique P416_HLG_Y
  1230. {
  1231. pass
  1232. {
  1233. vertex_shader = VSPos(id);
  1234. pixel_shader = PS_P416_HLG_Y_709_2020(frag_in);
  1235. }
  1236. }
  1237. technique P416_SRGB_Y
  1238. {
  1239. pass
  1240. {
  1241. vertex_shader = VSPos(id);
  1242. pixel_shader = PS_P416_SRGB_Y(frag_in);
  1243. }
  1244. }
  1245. technique P416_PQ_UV
  1246. {
  1247. pass
  1248. {
  1249. vertex_shader = VSPos(id);
  1250. pixel_shader = PS_P416_PQ_UV_709_2020(frag_in);
  1251. }
  1252. }
  1253. technique P416_HLG_UV
  1254. {
  1255. pass
  1256. {
  1257. vertex_shader = VSPos(id);
  1258. pixel_shader = PS_P416_HLG_UV_709_2020(frag_in);
  1259. }
  1260. }
  1261. technique P416_SRGB_UV
  1262. {
  1263. pass
  1264. {
  1265. vertex_shader = VSPos(id);
  1266. pixel_shader = PS_P416_SRGB_UV(frag_in);
  1267. }
  1268. }
  1269. technique UYVY_Reverse
  1270. {
  1271. pass
  1272. {
  1273. vertex_shader = VSPacked422Left_Reverse(id);
  1274. pixel_shader = PSUYVY_Reverse(frag_in);
  1275. }
  1276. }
  1277. technique YUY2_Reverse
  1278. {
  1279. pass
  1280. {
  1281. vertex_shader = VSPacked422Left_Reverse(id);
  1282. pixel_shader = PSYUY2_Reverse(frag_in);
  1283. }
  1284. }
  1285. technique YUY2_PQ_Reverse
  1286. {
  1287. pass
  1288. {
  1289. vertex_shader = VSPacked422Left_Reverse(id);
  1290. pixel_shader = PSYUY2_PQ_Reverse(frag_in);
  1291. }
  1292. }
  1293. technique YUY2_HLG_Reverse
  1294. {
  1295. pass
  1296. {
  1297. vertex_shader = VSPacked422Left_Reverse(id);
  1298. pixel_shader = PSYUY2_HLG_Reverse(frag_in);
  1299. }
  1300. }
  1301. technique YVYU_Reverse
  1302. {
  1303. pass
  1304. {
  1305. vertex_shader = VSPacked422Left_Reverse(id);
  1306. pixel_shader = PSYVYU_Reverse(frag_in);
  1307. }
  1308. }
  1309. technique I420_Reverse
  1310. {
  1311. pass
  1312. {
  1313. vertex_shader = VS420Left_Reverse(id);
  1314. pixel_shader = PSPlanar420_Reverse(frag_in);
  1315. }
  1316. }
  1317. technique I420_PQ_Reverse
  1318. {
  1319. pass
  1320. {
  1321. vertex_shader = VS420TopLeft_Reverse(id);
  1322. pixel_shader = PSPlanar420_PQ_Reverse(frag_in);
  1323. }
  1324. }
  1325. technique I420_HLG_Reverse
  1326. {
  1327. pass
  1328. {
  1329. vertex_shader = VS420TopLeft_Reverse(id);
  1330. pixel_shader = PSPlanar420_HLG_Reverse(frag_in);
  1331. }
  1332. }
  1333. technique I40A_Reverse
  1334. {
  1335. pass
  1336. {
  1337. vertex_shader = VS420Left_Reverse(id);
  1338. pixel_shader = PSPlanar420A_Reverse(frag_in);
  1339. }
  1340. }
  1341. technique I422_Reverse
  1342. {
  1343. pass
  1344. {
  1345. vertex_shader = VS422Left_Reverse(id);
  1346. pixel_shader = PSPlanar422_Reverse(frag_in);
  1347. }
  1348. }
  1349. technique I210_Reverse
  1350. {
  1351. pass
  1352. {
  1353. vertex_shader = VS422Left_Reverse(id);
  1354. pixel_shader = PSPlanar422_10LE_Reverse(frag_in);
  1355. }
  1356. }
  1357. technique I210_PQ_Reverse
  1358. {
  1359. pass
  1360. {
  1361. vertex_shader = VS422Left_Reverse(id);
  1362. pixel_shader = PSPlanar422_10LE_PQ_Reverse(frag_in);
  1363. }
  1364. }
  1365. technique I210_HLG_Reverse
  1366. {
  1367. pass
  1368. {
  1369. vertex_shader = VS422Left_Reverse(id);
  1370. pixel_shader = PSPlanar422_10LE_HLG_Reverse(frag_in);
  1371. }
  1372. }
  1373. technique I42A_Reverse
  1374. {
  1375. pass
  1376. {
  1377. vertex_shader = VS422Left_Reverse(id);
  1378. pixel_shader = PSPlanar422A_Reverse(frag_in);
  1379. }
  1380. }
  1381. technique I444_Reverse
  1382. {
  1383. pass
  1384. {
  1385. vertex_shader = VSPos(id);
  1386. pixel_shader = PSPlanar444_Reverse(frag_in);
  1387. }
  1388. }
  1389. technique I412_Reverse
  1390. {
  1391. pass
  1392. {
  1393. vertex_shader = VSPos(id);
  1394. pixel_shader = PSPlanar444_12LE_Reverse(frag_in);
  1395. }
  1396. }
  1397. technique I412_PQ_Reverse
  1398. {
  1399. pass
  1400. {
  1401. vertex_shader = VSPos(id);
  1402. pixel_shader = PSPlanar444_12LE_PQ_Reverse(frag_in);
  1403. }
  1404. }
  1405. technique I412_HLG_Reverse
  1406. {
  1407. pass
  1408. {
  1409. vertex_shader = VSPos(id);
  1410. pixel_shader = PSPlanar444_12LE_HLG_Reverse(frag_in);
  1411. }
  1412. }
  1413. technique YUVA_Reverse
  1414. {
  1415. pass
  1416. {
  1417. vertex_shader = VSPos(id);
  1418. pixel_shader = PSPlanar444A_Reverse(frag_in);
  1419. }
  1420. }
  1421. technique YA2L_Reverse
  1422. {
  1423. pass
  1424. {
  1425. vertex_shader = VSPos(id);
  1426. pixel_shader = PSPlanar444A_12LE_Reverse(frag_in);
  1427. }
  1428. }
  1429. technique AYUV_Reverse
  1430. {
  1431. pass
  1432. {
  1433. vertex_shader = VSPos(id);
  1434. pixel_shader = PSAYUV_Reverse(frag_in);
  1435. }
  1436. }
  1437. technique NV12_Reverse
  1438. {
  1439. pass
  1440. {
  1441. vertex_shader = VS420Left_Reverse(id);
  1442. pixel_shader = PSNV12_Reverse(frag_in);
  1443. }
  1444. }
  1445. technique NV12_PQ_Reverse
  1446. {
  1447. pass
  1448. {
  1449. vertex_shader = VS420TopLeft_Reverse(id);
  1450. pixel_shader = PSNV12_PQ_Reverse(frag_in);
  1451. }
  1452. }
  1453. technique NV12_HLG_Reverse
  1454. {
  1455. pass
  1456. {
  1457. vertex_shader = VS420TopLeft_Reverse(id);
  1458. pixel_shader = PSNV12_HLG_Reverse(frag_in);
  1459. }
  1460. }
  1461. technique I010_SRGB_Reverse
  1462. {
  1463. pass
  1464. {
  1465. vertex_shader = VS420Left_Reverse(id);
  1466. pixel_shader = PSI010_SRGB_Reverse(frag_in);
  1467. }
  1468. }
  1469. technique I010_PQ_2020_709_Reverse
  1470. {
  1471. pass
  1472. {
  1473. vertex_shader = VS420TopLeft_Reverse(id);
  1474. pixel_shader = PSI010_PQ_2020_709_Reverse(frag_in);
  1475. }
  1476. }
  1477. technique I010_HLG_2020_709_Reverse
  1478. {
  1479. pass
  1480. {
  1481. vertex_shader = VS420TopLeft_Reverse(id);
  1482. pixel_shader = PSI010_HLG_2020_709_Reverse(frag_in);
  1483. }
  1484. }
  1485. technique P010_SRGB_Reverse
  1486. {
  1487. pass
  1488. {
  1489. vertex_shader = VS420Left_Reverse(id);
  1490. pixel_shader = PSP010_SRGB_Reverse(frag_in);
  1491. }
  1492. }
  1493. technique P010_PQ_2020_709_Reverse
  1494. {
  1495. pass
  1496. {
  1497. vertex_shader = VS420TopLeft_Reverse(id);
  1498. pixel_shader = PSP010_PQ_2020_709_Reverse(frag_in);
  1499. }
  1500. }
  1501. technique P010_HLG_2020_709_Reverse
  1502. {
  1503. pass
  1504. {
  1505. vertex_shader = VS420TopLeft_Reverse(id);
  1506. pixel_shader = PSP010_HLG_2020_709_Reverse(frag_in);
  1507. }
  1508. }
  1509. technique V210_SRGB_Reverse
  1510. {
  1511. pass
  1512. {
  1513. vertex_shader = VSPos(id);
  1514. pixel_shader = PSV210_SRGB_Reverse(frag_in);
  1515. }
  1516. }
  1517. technique V210_PQ_2020_709_Reverse
  1518. {
  1519. pass
  1520. {
  1521. vertex_shader = VSPos(id);
  1522. pixel_shader = PSV210_PQ_2020_709_Reverse(frag_in);
  1523. }
  1524. }
  1525. technique V210_HLG_2020_709_Reverse
  1526. {
  1527. pass
  1528. {
  1529. vertex_shader = VSPos(id);
  1530. pixel_shader = PSV210_HLG_2020_709_Reverse(frag_in);
  1531. }
  1532. }
  1533. technique Y800_Limited
  1534. {
  1535. pass
  1536. {
  1537. vertex_shader = VSPos(id);
  1538. pixel_shader = PSY800_Limited(frag_in);
  1539. }
  1540. }
  1541. technique Y800_Full
  1542. {
  1543. pass
  1544. {
  1545. vertex_shader = VSPos(id);
  1546. pixel_shader = PSY800_Full(frag_in);
  1547. }
  1548. }
  1549. technique RGB_Limited
  1550. {
  1551. pass
  1552. {
  1553. vertex_shader = VSPos(id);
  1554. pixel_shader = PSRGB_Limited(frag_in);
  1555. }
  1556. }
  1557. technique BGR3_Limited
  1558. {
  1559. pass
  1560. {
  1561. vertex_shader = VSPos(id);
  1562. pixel_shader = PSBGR3_Limited(frag_in);
  1563. }
  1564. }
  1565. technique BGR3_Full
  1566. {
  1567. pass
  1568. {
  1569. vertex_shader = VSPos(id);
  1570. pixel_shader = PSBGR3_Full(frag_in);
  1571. }
  1572. }
  1573. technique R10L_SRGB_Full_Reverse
  1574. {
  1575. pass
  1576. {
  1577. vertex_shader = VSPos(id);
  1578. pixel_shader = PSR10L_SRGB_Full_Reverse(frag_in);
  1579. }
  1580. }
  1581. technique R10L_PQ_2020_709_Full_Reverse
  1582. {
  1583. pass
  1584. {
  1585. vertex_shader = VSPos(id);
  1586. pixel_shader = PSR10L_PQ_2020_709_Full_Reverse(frag_in);
  1587. }
  1588. }
  1589. technique R10L_HLG_2020_709_Full_Reverse
  1590. {
  1591. pass
  1592. {
  1593. vertex_shader = VSPos(id);
  1594. pixel_shader = PSR10L_HLG_2020_709_Full_Reverse(frag_in);
  1595. }
  1596. }
  1597. technique R10L_SRGB_Limited_Reverse
  1598. {
  1599. pass
  1600. {
  1601. vertex_shader = VSPos(id);
  1602. pixel_shader = PSR10L_SRGB_Limited_Reverse(frag_in);
  1603. }
  1604. }
  1605. technique R10L_PQ_2020_709_Limited_Reverse
  1606. {
  1607. pass
  1608. {
  1609. vertex_shader = VSPos(id);
  1610. pixel_shader = PSR10L_PQ_2020_709_Limited_Reverse(frag_in);
  1611. }
  1612. }
  1613. technique R10L_HLG_2020_709_Limited_Reverse
  1614. {
  1615. pass
  1616. {
  1617. vertex_shader = VSPos(id);
  1618. pixel_shader = PSR10L_HLG_2020_709_Limited_Reverse(frag_in);
  1619. }
  1620. }