Skip to content

Instantly share code, notes, and snippets.

@GaryOderNichts
Created February 4, 2024 17:55
Show Gist options
  • Save GaryOderNichts/09f0b17f07346d46c849097a903931c0 to your computer and use it in GitHub Desktop.
Save GaryOderNichts/09f0b17f07346d46c849097a903931c0 to your computer and use it in GitHub Desktop.
; $MODE = "UniformRegister"
; $NUM_SPI_PS_INPUT_CNTL = 1
; texCoords R0
; $SPI_PS_INPUT_CNTL[0].SEMANTIC = 0
; $SPI_PS_INPUT_CNTL[0].DEFAULT_VAL = 1
; $SAMPLER_VARS[0].name = "tex0"
; $SAMPLER_VARS[0].type = "SAMPLER2D"
; $SAMPLER_VARS[0].location = 0
; $SAMPLER_VARS[1].name = "tex1"
; $SAMPLER_VARS[1].type = "SAMPLER2D"
; $SAMPLER_VARS[1].location = 1
; $SAMPLER_VARS[2].name = "tex2"
; $SAMPLER_VARS[2].type = "SAMPLER2D"
; $SAMPLER_VARS[2].location = 2
; converts YUV420P to RGB
; tex0 contains the Y plane, tex1 the U plane, tex2 the V plane
; based on: https://gist.github.com/crearo/798412489698e749c17e572e74496e1b
00 TEX: ADDR(48) CNT(3) VALID_PIX
0 SAMPLE R1.x___, R0.xy0x, t0, s0
1 SAMPLE R1._x__, R0.xy0x, t1, s1
2 SAMPLE R1.__x_, R0.xy0x, t2, s2
01 ALU: ADDR(32) CNT(14)
3 x: ADD R1.x, R1.x, -0.0625
y: ADD R1.y, R1.y, -0.5
z: ADD R1.z, R1.z, -0.5
4 x: MUL R1.x, R1.x, 1.1643
5 x: MULADD R0.x, R1.z, 1.5958, R1.x
y: MULADD R0.y, R1.y, -0.39173, R1.x
z: MULADD R0.z, R1.y, 2.017, R1.x
6 y: MULADD R0.y, R1.z, -0.81290, R0.y
02 EXP_DONE: PIX0, R0.xyz1
END_OF_PROGRAM
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment