Merge pull request #2012 from machdyne/master

soc/cores/video: Add additional color formats
This commit is contained in:
enjoy-digital 2024-07-21 09:34:00 +02:00 committed by GitHub
commit 4662b95f16
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
1 changed files with 26 additions and 5 deletions

View File

@ -653,7 +653,10 @@ class VideoFrameBuffer(LiteXModule):
self.depth = depth = { self.depth = depth = {
"rgb888" : 32, "rgb888" : 32,
"rgb565" : 16 "rgb565" : 16,
"rgb332" : 8,
"mono8" : 8,
"mono1" : 1,
}[format] }[format]
# # # # # #
@ -732,12 +735,30 @@ class VideoFrameBuffer(LiteXModule):
source.g.eq(video_pipe_source.data[ 8:16]), source.g.eq(video_pipe_source.data[ 8:16]),
source.b.eq(video_pipe_source.data[16:24]), source.b.eq(video_pipe_source.data[16:24]),
] ]
else: # depth == 16 elif (depth == 16):
self.comb += [ self.comb += [
source.r.eq(Cat(Signal(3, reset = 0), video_pipe_source.data[11:16])), source.r.eq(Cat(Signal(3, reset = 0), video_pipe_source.data[11:16])),
source.g.eq(Cat(Signal(2, reset = 0), video_pipe_source.data[ 5:11])), source.g.eq(Cat(Signal(2, reset = 0), video_pipe_source.data[ 5:11])),
source.b.eq(Cat(Signal(3, reset = 0), video_pipe_source.data[ 0: 5])), source.b.eq(Cat(Signal(3, reset = 0), video_pipe_source.data[ 0: 5])),
] ]
elif (depth == 8 and format == "rgb332"):
self.comb += [
source.r.eq(Cat(Signal(5, reset = 0), video_pipe_source.data[5:8])),
source.g.eq(Cat(Signal(5, reset = 0), video_pipe_source.data[2:5])),
source.b.eq(Cat(Signal(6, reset = 0), video_pipe_source.data[0:2])),
]
elif (depth == 8 and format == "mono8"):
self.comb += [
source.r.eq(video_pipe_source.data[0:8]),
source.g.eq(video_pipe_source.data[0:8]),
source.b.eq(video_pipe_source.data[0:8]),
]
else: # depth == 1
self.comb += [
source.r.eq(Cat(Signal(7, reset = 0), video_pipe_source.data[0:1])),
source.g.eq(Cat(Signal(7, reset = 0), video_pipe_source.data[0:1])),
source.b.eq(Cat(Signal(7, reset = 0), video_pipe_source.data[0:1])),
]
# Underflow. # Underflow.
self.comb += self.underflow.eq(~source.valid) self.comb += self.underflow.eq(~source.valid)