Skip to content

Commit fd624d6

Browse files
committed
Fix incorrect value written in RpuDataNlq
Bug present since #1
1 parent c59b3cf commit fd624d6

File tree

1 file changed

+31
-1
lines changed

1 file changed

+31
-1
lines changed

dolby_vision/src/rpu/rpu_data_nlq.rs

Lines changed: 31 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -137,7 +137,7 @@ impl RpuDataNlq {
137137
)?;
138138

139139
if header.coefficient_data_type == 0 {
140-
writer.write_ue(&self.linear_deadzone_slope_int[cmp])?;
140+
writer.write_ue(&self.linear_deadzone_threshold_int[cmp])?;
141141
}
142142

143143
writer.write_n(
@@ -207,3 +207,33 @@ impl Display for DoviELType {
207207
f.write_str(self.as_str())
208208
}
209209
}
210+
211+
#[cfg(test)]
212+
mod tests {
213+
use anyhow::Result;
214+
215+
use crate::rpu::{dovi_rpu::DoviRpu, generate::GenerateConfig};
216+
217+
#[test]
218+
fn write_linear_dz_threshold() -> Result<()> {
219+
let mut rpu = DoviRpu::profile81_config(&GenerateConfig::default())?;
220+
rpu.convert_with_mode(1)?;
221+
222+
{
223+
let nlq = rpu
224+
.rpu_data_mapping
225+
.as_mut()
226+
.and_then(|rpu_data_mapping| rpu_data_mapping.nlq.as_mut())
227+
.unwrap();
228+
nlq.linear_deadzone_threshold_int = [1, 2, 3];
229+
}
230+
231+
let out = rpu.write_rpu()?;
232+
let rpu = DoviRpu::parse(&out)?;
233+
234+
let nlq = rpu.rpu_data_mapping.and_then(|e| e.nlq).unwrap();
235+
assert_eq!(nlq.linear_deadzone_threshold_int, [1, 2, 3]);
236+
237+
Ok(())
238+
}
239+
}

0 commit comments

Comments
 (0)