-
Notifications
You must be signed in to change notification settings - Fork 451
Small video-related refactor #7660
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from 5 commits
d66a48c
c38db76
831239b
76a351b
53e593d
a5c4a01
a6f03cb
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -144,6 +144,7 @@ impl VideoData { | |
data: data.to_vec(), | ||
timestamp: sample.decode_timestamp, | ||
duration: sample.duration, | ||
is_sync: sample.is_sync, | ||
}) | ||
} | ||
} | ||
|
@@ -174,6 +175,9 @@ impl GroupOfPictures { | |
/// A single sample in a video. | ||
#[derive(Debug, Clone)] | ||
pub struct Sample { | ||
/// The start of a new [`GroupOfPictures`]? | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. why the question mark? That is how we defined them, no? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This is the question the boolean answers |
||
pub is_sync: bool, | ||
|
||
/// Time at which this sample appears in the decoded bitstream, in time units. | ||
/// | ||
/// Samples should be decoded in this order. | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -129,6 +129,22 @@ fn copy_video_frame_to_texture( | |
frame: &Frame, | ||
texture: &wgpu::Texture, | ||
) -> Result<(), DecodingError> { | ||
let format = match frame.format { | ||
re_video::PixelFormat::Rgb8Unorm => { | ||
return copy_video_frame_to_texture( | ||
queue, | ||
&Frame { | ||
data: crate::pad_rgb_to_rgba(&frame.data, 255_u8), | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I'd be a lot happier if this goes through texture manager's format conversions that landed on main now because that's what is going to happen with AV1 output now There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Of course - that's part of #7608. But that's a much bigger PR than this one. |
||
format: re_video::PixelFormat::Rgba8Unorm, | ||
..*frame | ||
}, | ||
texture, | ||
); | ||
} | ||
|
||
re_video::PixelFormat::Rgba8Unorm => wgpu::TextureFormat::Rgba8Unorm, | ||
}; | ||
|
||
re_tracing::profile_function!(); | ||
|
||
let size = wgpu::Extent3d { | ||
|
@@ -137,10 +153,6 @@ fn copy_video_frame_to_texture( | |
depth_or_array_layers: 1, | ||
}; | ||
|
||
let format = match frame.format { | ||
re_video::PixelFormat::Rgba8Unorm => wgpu::TextureFormat::Rgba8Unorm, | ||
}; | ||
|
||
let width_blocks = frame.width / format.block_dimensions().0; | ||
|
||
#[allow(clippy::unwrap_used)] // block_copy_size can only fail for weird compressed formats | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is the FFMPEG output
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
it doesn't have to be though, we can choose that fairly freely, no?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Not completely freely. We can pcik
rgb24
, but notrgba32
, for instanceThere was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We can pick some yuv formats for sure, but we didn't have GPU support for that when I wrote this code.