rendering tests fixed
This commit is contained in:
@@ -0,0 +1,27 @@
|
||||
package generator
|
||||
|
||||
import "encoding/binary"
|
||||
|
||||
func sampleV210(buf []byte, width, x, y int) (yc, cb, cr uint32) {
|
||||
pixel := y*width + x
|
||||
offset := (pixel / 6) * 16
|
||||
w0 := binary.LittleEndian.Uint32(buf[offset:])
|
||||
w1 := binary.LittleEndian.Uint32(buf[offset+4:])
|
||||
w2 := binary.LittleEndian.Uint32(buf[offset+8:])
|
||||
w3 := binary.LittleEndian.Uint32(buf[offset+12:])
|
||||
|
||||
switch pixel % 6 {
|
||||
case 0:
|
||||
return (w0 >> 10) & 0x3FF, w0 & 0x3FF, (w0 >> 20) & 0x3FF
|
||||
case 1:
|
||||
return w1 & 0x3FF, w0 & 0x3FF, (w0 >> 20) & 0x3FF
|
||||
case 2:
|
||||
return (w1 >> 20) & 0x3FF, (w1 >> 10) & 0x3FF, w2 & 0x3FF
|
||||
case 3:
|
||||
return (w2 >> 10) & 0x3FF, (w1 >> 10) & 0x3FF, w2 & 0x3FF
|
||||
case 4:
|
||||
return w3 & 0x3FF, (w2 >> 20) & 0x3FF, (w3 >> 10) & 0x3FF
|
||||
default:
|
||||
return (w3 >> 20) & 0x3FF, (w2 >> 20) & 0x3FF, (w3 >> 10) & 0x3FF
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user