Skip to content

🎥 Make videos programmatically with React

revert

Jonny Burger896c14c92ee1
diff --git a/packages/renderer/rust/scalable_frame.rs b/packages/renderer/rust/scalable_frame.rs
index 23691e4cda..45a24fd7e7 100644
--- a/packages/renderer/rust/scalable_frame.rs
+++ b/packages/renderer/rust/scalable_frame.rs
@@ -68,8 +68,7 @@ impl ScalableFrame {
let mut planes: Vec<Vec<u8>>;
let format: Pixel;
let linesize: [i32; 8];
- let (mut filter, should_filter, is_tagged_bt709) =
- make_tone_map_filtergraph(frame.filter_graph)?;
+ let (mut filter, should_filter) = make_tone_map_filtergraph(frame.filter_graph)?;
if frame.tone_mapped && should_filter {
video = frame::Video::empty();
filter
@@ -103,14 +102,8 @@ impl ScalableFrame {
linesize = unsafe { (*frame.unscaled_frame.as_ptr()).linesize };
}
- let bitmap = scale_and_make_bitmap(
- &frame,
- planes,
- format,
- linesize,
- self.transparent,
- is_tagged_bt709,
- )?;
+ let bitmap =
+ scale_and_make_bitmap(&frame, planes, format, linesize, self.transparent)?;
self.rgb_frame = Some(RgbFrame { data: bitmap });
self.native_frame = None;
Ok(())
@@ -194,7 +187,6 @@ pub fn scale_and_make_bitmap(
src_format: Pixel,
linesize: [i32; 8],
transparent: bool,
- should_be_tagged_bt709: bool,
) -> Result<Vec<u8>, ErrorWithBacktrace> {
let dst_format: Pixel = match transparent {
true => Pixel::RGBA,
@@ -288,14 +280,6 @@ pub fn scale_and_make_bitmap(
}
}
- if should_be_tagged_bt709 {
- _print_verbose(&format!(
- "Source video {} is tagged as BT709. Converting to RGBA and returning PNG with BT709 color space for better color accuracy.",
- native_frame.original_src
- ))?;
- return get_png_data(&convert_to_rgba(&rotated), rotated_width, rotated_height);
- }
-
Ok(create_bmp_image_from_frame(
&rotated,
rotated_width,
@@ -304,13 +288,6 @@ pub fn scale_and_make_bitmap(
))
}
-pub fn convert_to_rgba(data: &[u8]) -> Vec<u8> {
- let mut newrot = Vec::with_capacity(data.len() + data.len() / 3);
- let chunks = data.chunks(3);
- newrot.extend(chunks.flat_map(|chunk| std::iter::once(255).chain(chunk.iter().copied())));
- newrot
-}
-
pub fn rotate_270(
data: &[u8],
width: u32,
diff --git a/packages/renderer/rust/tone_map.rs b/packages/renderer/rust/tone_map.rs
index 04060d4b5a..ac1d11c9b5 100644
--- a/packages/renderer/rust/tone_map.rs
+++ b/packages/renderer/rust/tone_map.rs
@@ -20,9 +20,7 @@ pub struct FilterGraph {
pub aspect_ratio: Rational,
}
-pub fn make_tone_map_filtergraph(
- graph: FilterGraph,
-) -> Result<(Graph, bool, bool), ffmpeg_next::Error> {
+pub fn make_tone_map_filtergraph(graph: FilterGraph) -> Result<(Graph, bool), ffmpeg_next::Error> {
let mut filter = filter::Graph::new();
let original_width = graph.original_width;
@@ -80,8 +78,6 @@ pub fn make_tone_map_filtergraph(
_ => "input",
};
- let is_tagged_bt709 = matrix_in == "709" && transfer_in == "709" && primaries == "709";
-
let matrix_is_target =
matrix_in == "input" || matrix_in == "470bg" || matrix_in == "709" || matrix_in == "170m";
let transfer_is_target = transfer_in == "input" || transfer_in == "709";
@@ -118,5 +114,5 @@ pub fn make_tone_map_filtergraph(
filter.validate()?;
- Ok((filter, !needs_conversion, is_tagged_bt709))
+ Ok((filter, !needs_conversion))
}