Skip to content

Commit

Permalink
struct Rav1dFrameHeader_super_res: make enabled a bool
Browse files Browse the repository at this point in the history
  • Loading branch information
folkertdev committed Mar 6, 2024
1 parent f4b7dc8 commit 1fd3ad7
Show file tree
Hide file tree
Showing 4 changed files with 12 additions and 12 deletions.
6 changes: 3 additions & 3 deletions include/dav1d/headers.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1631,7 +1631,7 @@ pub struct Dav1dFrameHeader_super_res {
#[repr(C)]
pub struct Rav1dFrameHeader_super_res {
pub width_scale_denominator: c_int,
pub enabled: c_int,
pub enabled: bool,
}

impl From<Dav1dFrameHeader_super_res> for Rav1dFrameHeader_super_res {
Expand All @@ -1642,7 +1642,7 @@ impl From<Dav1dFrameHeader_super_res> for Rav1dFrameHeader_super_res {
} = value;
Self {
width_scale_denominator,
enabled,
enabled: enabled != 0,
}
}
}
Expand All @@ -1655,7 +1655,7 @@ impl From<Rav1dFrameHeader_super_res> for Dav1dFrameHeader_super_res {
} = value;
Self {
width_scale_denominator,
enabled,
enabled: enabled as c_int,
}
}
}
Expand Down
2 changes: 1 addition & 1 deletion src/lf_apply.rs
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ unsafe fn backup_lpf<BD: BitDepth>(
bitdepth_max: c_int,
) {
let cdef_backup = (lr_backup == 0) as c_int;
let dst_w = if frame_hdr.size.super_res.enabled != 0 {
let dst_w = if frame_hdr.size.super_res.enabled {
frame_hdr.size.width[1] + ss_hor >> ss_hor
} else {
src_w
Expand Down
14 changes: 7 additions & 7 deletions src/obu.rs
Original file line number Diff line number Diff line change
Expand Up @@ -568,10 +568,10 @@ unsafe fn parse_frame_size(
let height = ref_size.height;
let render_width = ref_size.render_width;
let render_height = ref_size.render_height;
let enabled = (seqhdr.super_res != 0 && gb.get_bit()) as c_int;
let enabled = seqhdr.super_res != 0 && gb.get_bit();
let width_scale_denominator;
let width0;
if enabled != 0 {
if enabled {
width_scale_denominator = 9 + gb.get_bits(3) as c_int;
let d = width_scale_denominator;
width0 = cmp::max((width1 * 8 + (d >> 1)) / d, cmp::min(16, width1));
Expand Down Expand Up @@ -604,10 +604,10 @@ unsafe fn parse_frame_size(
width1 = seqhdr.max_width;
height = seqhdr.max_height;
}
let enabled = (seqhdr.super_res != 0 && gb.get_bit()) as c_int;
let enabled = seqhdr.super_res != 0 && gb.get_bit();
let width_scale_denominator;
let width0;
if enabled != 0 {
if enabled {
width_scale_denominator = 9 + gb.get_bits(3) as c_int;
let d = width_scale_denominator;
width0 = cmp::max((width1 * 8 + (d >> 1)) / d, cmp::min(16, width1));
Expand Down Expand Up @@ -1302,14 +1302,14 @@ fn parse_cdef(
fn parse_restoration(
seqhdr: &Rav1dSequenceHeader,
all_lossless: bool,
super_res_enabled: c_int,
super_res_enabled: bool,
allow_intrabc: bool,
debug: &Debug,
gb: &mut GetBits,
) -> Rav1dFrameHeader_restoration {
let r#type;
let unit_size;
if (!all_lossless || super_res_enabled != 0) && seqhdr.restoration != 0 && !allow_intrabc {
if (!all_lossless || super_res_enabled) && seqhdr.restoration != 0 && !allow_intrabc {
let type_0 = Rav1dRestorationType::from_repr(gb.get_bits(2) as usize).unwrap();
r#type = if seqhdr.monochrome == 0 {
[
Expand Down Expand Up @@ -1878,7 +1878,7 @@ unsafe fn parse_frame_hdr(
return Err(EINVAL);
}
size = parse_frame_size(c, seqhdr, None, frame_size_override, gb)?;
allow_intrabc = allow_screen_content_tools && size.super_res.enabled == 0 && gb.get_bit();
allow_intrabc = allow_screen_content_tools && !size.super_res.enabled && gb.get_bit();
use_ref_frame_mvs = 0;

// Default initialization.
Expand Down
2 changes: 1 addition & 1 deletion src/recon.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3308,7 +3308,7 @@ pub(crate) unsafe fn rav1d_recon_b_inter<BD: BitDepth>(
4 * ((t.bx >> ss_hor) as isize + (t.by >> ss_ver) as isize * BD::pxstride(f.cur.stride[1]));
let frame_hdr = &***f.frame_hdr.as_ref().unwrap();
if frame_hdr.frame_type.is_key_or_intra() {
if frame_hdr.size.super_res.enabled != 0 {
if frame_hdr.size.super_res.enabled {
unreachable!();
}
res = mc::<BD>(
Expand Down

0 comments on commit 1fd3ad7

Please sign in to comment.