Files
go-mxl-pattern-generator/internal/video/pattern.go
T
2026-09-17 20:21:16 +03:00

73 lines
2.2 KiB
Go

package video
import "sort"
type PatternInfo struct {
Name string
Description string
}
type pattern struct {
PatternInfo
kernelPath string
}
var patterns = map[string]pattern{
"ebu75": {
PatternInfo: PatternInfo{Name: "ebu75", Description: "EBU 75% Color Bar Signal"},
kernelPath: "kernels/static/ebu75.wgsl",
},
"ebu75-move": {
PatternInfo: PatternInfo{Name: "ebu75-move", Description: "EBU 75% Color Bar Signal with moving square"},
kernelPath: "kernels/dynamic/ebu75.wgsl",
},
"ebu100": {
PatternInfo: PatternInfo{Name: "ebu100", Description: "EBU 100% Color Bar Signal"},
kernelPath: "kernels/static/ebu100.wgsl",
},
"ebu100-move": {
PatternInfo: PatternInfo{Name: "ebu100-move", Description: "EBU 100% Color Bar Signal with moving square"},
kernelPath: "kernels/dynamic/ebu100.wgsl",
},
"smpte": {
PatternInfo: PatternInfo{Name: "smpte", Description: "SMPTE RP-219 Color Bar Signal"},
kernelPath: "kernels/static/smpteBars.wgsl",
},
"smpte-move": {
PatternInfo: PatternInfo{Name: "smpte-move", Description: "SMPTE RP-219 Color Bar Signal with moving square"},
kernelPath: "kernels/dynamic/smpteBars.wgsl",
},
"gray-bars": {
PatternInfo: PatternInfo{Name: "gray-bars", Description: "13-step grayscale bars (Y 64..940)"},
kernelPath: "kernels/static/yBars.wgsl",
},
"gray-bars-move": {
PatternInfo: PatternInfo{Name: "gray-bars-move", Description: "13-step grayscale bars (Y 64..940) with moving square"},
kernelPath: "kernels/dynamic/yBars.wgsl",
},
"gray-ramp": {
PatternInfo: PatternInfo{Name: "gray-ramp", Description: "Y gradient (black -> 100% white)"},
kernelPath: "kernels/static/yRamp.wgsl",
},
"gray-ramp-move": {
PatternInfo: PatternInfo{Name: "gray-ramp-move", Description: "Y gradient with moving square"},
kernelPath: "kernels/dynamic/yRamp.wgsl",
},
}
func HasPattern(name string) bool {
_, ok := patterns[name]
return ok
}
func Patterns() []PatternInfo {
result := make([]PatternInfo, 0, len(patterns))
for _, pattern := range patterns {
result = append(result, pattern.PatternInfo)
}
sort.Slice(result, func(i, j int) bool {
return result[i].Name < result[j].Name
})
return result
}