Skip to content

Commit

Permalink
struct Dav1dFrameContext::ipred_edge: Use DynPixel instead of `c_…
Browse files Browse the repository at this point in the history
…void` for clarity (in a still duplicated type).
  • Loading branch information
kkysen committed Sep 19, 2023
1 parent 6ce7870 commit 1b5ba1a
Show file tree
Hide file tree
Showing 15 changed files with 35 additions and 21 deletions.
3 changes: 2 additions & 1 deletion src/cdef_apply_tmpl_16.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
use std::cmp;

use crate::include::common::bitdepth::DynPixel;
use crate::include::stddef::*;
use crate::include::stdint::*;

Expand Down Expand Up @@ -48,7 +49,7 @@ pub struct Dav1dFrameContext {
pub dsp: *const Dav1dDSPContext,
pub bd_fn: Dav1dFrameContext_bd_fn,
pub ipred_edge_sz: libc::c_int,
pub ipred_edge: [*mut libc::c_void; 3],
pub ipred_edge: [*mut DynPixel; 3],
pub b4_stride: ptrdiff_t,
pub w4: libc::c_int,
pub h4: libc::c_int,
Expand Down
3 changes: 2 additions & 1 deletion src/cdef_apply_tmpl_8.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
use std::cmp;

use crate::include::common::bitdepth::DynPixel;
use crate::include::stddef::*;
use crate::include::stdint::*;

Expand Down Expand Up @@ -48,7 +49,7 @@ pub struct Dav1dFrameContext {
pub dsp: *const Dav1dDSPContext,
pub bd_fn: Dav1dFrameContext_bd_fn,
pub ipred_edge_sz: libc::c_int,
pub ipred_edge: [*mut libc::c_void; 3],
pub ipred_edge: [*mut DynPixel; 3],
pub b4_stride: ptrdiff_t,
pub w4: libc::c_int,
pub h4: libc::c_int,
Expand Down
3 changes: 2 additions & 1 deletion src/cdf.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
use std::cmp;

use crate::include::common::bitdepth::DynPixel;
use crate::include::stddef::*;
use crate::include::stdint::*;
use crate::src::align::*;
Expand Down Expand Up @@ -54,7 +55,7 @@ pub struct Dav1dFrameContext {
pub dsp: *const Dav1dDSPContext,
pub bd_fn: Dav1dFrameContext_bd_fn,
pub ipred_edge_sz: libc::c_int,
pub ipred_edge: [*mut libc::c_void; 3],
pub ipred_edge: [*mut DynPixel; 3],
pub b4_stride: ptrdiff_t,
pub w4: libc::c_int,
pub h4: libc::c_int,
Expand Down
12 changes: 6 additions & 6 deletions src/decode.rs
Original file line number Diff line number Diff line change
Expand Up @@ -218,7 +218,7 @@ pub struct Dav1dFrameContext {
pub dsp: *const Dav1dDSPContext,
pub bd_fn: Dav1dFrameContext_bd_fn,
pub ipred_edge_sz: libc::c_int,
pub ipred_edge: [*mut libc::c_void; 3],
pub ipred_edge: [*mut DynPixel; 3],
pub b4_stride: ptrdiff_t,
pub w4: libc::c_int,
pub h4: libc::c_int,
Expand Down Expand Up @@ -5171,17 +5171,17 @@ pub unsafe extern "C" fn dav1d_decode_frame_init(f: *mut Dav1dFrameContext) -> l
let ipred_edge_sz = f.sbh * f.sb128w << hbd;
if ipred_edge_sz != f.ipred_edge_sz {
dav1d_freep_aligned(
&mut *f.ipred_edge.as_mut_ptr().offset(0) as *mut *mut libc::c_void
as *mut libc::c_void,
&mut *f.ipred_edge.as_mut_ptr().offset(0) as *mut *mut DynPixel as *mut libc::c_void,
);
f.ipred_edge[0] = dav1d_alloc_aligned(ipred_edge_sz as usize * 128 * 3, 64);
f.ipred_edge[0] =
dav1d_alloc_aligned(ipred_edge_sz as usize * 128 * 3, 64) as *mut DynPixel;
let ptr = f.ipred_edge[0] as *mut u8;
if ptr.is_null() {
f.ipred_edge_sz = 0;
return -12;
}
f.ipred_edge[1] = ptr.offset(ipred_edge_sz as isize * 128 * 1) as *mut libc::c_void;
f.ipred_edge[2] = ptr.offset(ipred_edge_sz as isize * 128 * 2) as *mut libc::c_void;
f.ipred_edge[1] = ptr.offset(ipred_edge_sz as isize * 128 * 1) as *mut DynPixel;
f.ipred_edge[2] = ptr.offset(ipred_edge_sz as isize * 128 * 2) as *mut DynPixel;
f.ipred_edge_sz = ipred_edge_sz;
}

Expand Down
3 changes: 2 additions & 1 deletion src/lf_apply_tmpl_16.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
use std::cmp;

use crate::include::common::bitdepth::DynPixel;
use crate::include::stddef::*;
use crate::include::stdint::*;

Expand Down Expand Up @@ -48,7 +49,7 @@ pub struct Dav1dFrameContext {
pub dsp: *const Dav1dDSPContext,
pub bd_fn: Dav1dFrameContext_bd_fn,
pub ipred_edge_sz: libc::c_int,
pub ipred_edge: [*mut libc::c_void; 3],
pub ipred_edge: [*mut DynPixel; 3],
pub b4_stride: ptrdiff_t,
pub w4: libc::c_int,
pub h4: libc::c_int,
Expand Down
3 changes: 2 additions & 1 deletion src/lf_apply_tmpl_8.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
use std::cmp;

use crate::include::common::bitdepth::DynPixel;
use crate::include::stddef::*;
use crate::include::stdint::*;

Expand Down Expand Up @@ -48,7 +49,7 @@ pub struct Dav1dFrameContext {
pub dsp: *const Dav1dDSPContext,
pub bd_fn: Dav1dFrameContext_bd_fn,
pub ipred_edge_sz: libc::c_int,
pub ipred_edge: [*mut libc::c_void; 3],
pub ipred_edge: [*mut DynPixel; 3],
pub b4_stride: ptrdiff_t,
pub w4: libc::c_int,
pub h4: libc::c_int,
Expand Down
5 changes: 3 additions & 2 deletions src/lib.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
use std::cmp;

use crate::include::common::bitdepth::DynCoef;
use crate::include::common::bitdepth::DynPixel;
use crate::include::stddef::*;
use crate::include::stdint::*;
use crate::src::intra_edge::dav1d_init_mode_tree;
Expand Down Expand Up @@ -335,7 +336,7 @@ pub struct Dav1dFrameContext {
pub dsp: *const Dav1dDSPContext,
pub bd_fn: Dav1dFrameContext_bd_fn,
pub ipred_edge_sz: libc::c_int,
pub ipred_edge: [*mut libc::c_void; 3],
pub ipred_edge: [*mut DynPixel; 3],
pub b4_stride: ptrdiff_t,
pub w4: libc::c_int,
pub h4: libc::c_int,
Expand Down Expand Up @@ -1602,7 +1603,7 @@ unsafe extern "C" fn close_internal(c_out: *mut *mut Dav1dContext, flush: libc::
as *mut libc::c_void,
);
dav1d_free_aligned((*f).ts as *mut libc::c_void);
dav1d_free_aligned((*f).ipred_edge[0]);
dav1d_free_aligned((*f).ipred_edge[0] as *mut libc::c_void);
free((*f).a as *mut libc::c_void);
free((*f).tile as *mut libc::c_void);
free((*f).lf.mask as *mut libc::c_void);
Expand Down
3 changes: 2 additions & 1 deletion src/log.rs
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
use crate::include::common::bitdepth::DynPixel;
use crate::include::stddef::*;
use crate::include::stdint::*;

Expand Down Expand Up @@ -237,7 +238,7 @@ pub struct Dav1dFrameContext {
pub dsp: *const Dav1dDSPContext,
pub bd_fn: Dav1dFrameContext_bd_fn,
pub ipred_edge_sz: libc::c_int,
pub ipred_edge: [*mut libc::c_void; 3],
pub ipred_edge: [*mut DynPixel; 3],
pub b4_stride: ptrdiff_t,
pub w4: libc::c_int,
pub h4: libc::c_int,
Expand Down
3 changes: 2 additions & 1 deletion src/lr_apply_tmpl_16.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
use std::cmp;

use crate::include::common::bitdepth::DynPixel;
use crate::include::stddef::*;
use crate::include::stdint::*;

Expand Down Expand Up @@ -50,7 +51,7 @@ pub struct Dav1dFrameContext {
pub dsp: *const Dav1dDSPContext,
pub bd_fn: Dav1dFrameContext_bd_fn,
pub ipred_edge_sz: libc::c_int,
pub ipred_edge: [*mut libc::c_void; 3],
pub ipred_edge: [*mut DynPixel; 3],
pub b4_stride: ptrdiff_t,
pub w4: libc::c_int,
pub h4: libc::c_int,
Expand Down
3 changes: 2 additions & 1 deletion src/lr_apply_tmpl_8.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
use std::cmp;

use crate::include::common::bitdepth::DynPixel;
use crate::include::stddef::*;
use crate::include::stdint::*;

Expand Down Expand Up @@ -50,7 +51,7 @@ pub struct Dav1dFrameContext {
pub dsp: *const Dav1dDSPContext,
pub bd_fn: Dav1dFrameContext_bd_fn,
pub ipred_edge_sz: libc::c_int,
pub ipred_edge: [*mut libc::c_void; 3],
pub ipred_edge: [*mut DynPixel; 3],
pub b4_stride: ptrdiff_t,
pub w4: libc::c_int,
pub h4: libc::c_int,
Expand Down
3 changes: 2 additions & 1 deletion src/obu.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
use std::cmp;

use crate::include::common::bitdepth::DynPixel;
use crate::include::stddef::*;
use crate::include::stdint::*;

Expand Down Expand Up @@ -60,7 +61,7 @@ pub struct Dav1dFrameContext {
pub dsp: *const Dav1dDSPContext,
pub bd_fn: Dav1dFrameContext_bd_fn,
pub ipred_edge_sz: libc::c_int,
pub ipred_edge: [*mut libc::c_void; 3],
pub ipred_edge: [*mut DynPixel; 3],
pub b4_stride: ptrdiff_t,
pub w4: libc::c_int,
pub h4: libc::c_int,
Expand Down
3 changes: 2 additions & 1 deletion src/picture.rs
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
use crate::include::common::bitdepth::DynPixel;
use crate::include::stddef::*;
use crate::include::stdint::*;

Expand Down Expand Up @@ -54,7 +55,7 @@ pub struct Dav1dFrameContext {
pub dsp: *const Dav1dDSPContext,
pub bd_fn: Dav1dFrameContext_bd_fn,
pub ipred_edge_sz: libc::c_int,
pub ipred_edge: [*mut libc::c_void; 3],
pub ipred_edge: [*mut DynPixel; 3],
pub b4_stride: ptrdiff_t,
pub w4: libc::c_int,
pub h4: libc::c_int,
Expand Down
3 changes: 2 additions & 1 deletion src/recon_tmpl_16.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ use std::cmp;

use crate::include::common::bitdepth::BitDepth16;
use crate::include::common::bitdepth::DynCoef;
use crate::include::common::bitdepth::DynPixel;
use crate::include::stddef::*;
use crate::include::stdint::*;
use crate::src::ctx::CaseSet;
Expand Down Expand Up @@ -115,7 +116,7 @@ pub struct Dav1dFrameContext {
pub dsp: *const Dav1dDSPContext,
pub bd_fn: Dav1dFrameContext_bd_fn,
pub ipred_edge_sz: libc::c_int,
pub ipred_edge: [*mut libc::c_void; 3],
pub ipred_edge: [*mut DynPixel; 3],
pub b4_stride: ptrdiff_t,
pub w4: libc::c_int,
pub h4: libc::c_int,
Expand Down
3 changes: 2 additions & 1 deletion src/recon_tmpl_8.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ use std::cmp;

use crate::include::common::bitdepth::BitDepth8;
use crate::include::common::bitdepth::DynCoef;
use crate::include::common::bitdepth::DynPixel;
use crate::include::stddef::*;
use crate::include::stdint::*;
use crate::src::ctx::CaseSet;
Expand Down Expand Up @@ -114,7 +115,7 @@ pub struct Dav1dFrameContext {
pub dsp: *const Dav1dDSPContext,
pub bd_fn: Dav1dFrameContext_bd_fn,
pub ipred_edge_sz: libc::c_int,
pub ipred_edge: [*mut libc::c_void; 3],
pub ipred_edge: [*mut DynPixel; 3],
pub b4_stride: ptrdiff_t,
pub w4: libc::c_int,
pub h4: libc::c_int,
Expand Down
3 changes: 2 additions & 1 deletion src/thread_task.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
use std::cmp;

use crate::include::common::bitdepth::DynPixel;
use crate::include::stddef::*;
use crate::include::stdint::*;
use ::libc;
Expand Down Expand Up @@ -94,7 +95,7 @@ pub struct Dav1dFrameContext {
pub dsp: *const Dav1dDSPContext,
pub bd_fn: Dav1dFrameContext_bd_fn,
pub ipred_edge_sz: libc::c_int,
pub ipred_edge: [*mut libc::c_void; 3],
pub ipred_edge: [*mut DynPixel; 3],
pub b4_stride: ptrdiff_t,
pub w4: libc::c_int,
pub h4: libc::c_int,
Expand Down

0 comments on commit 1b5ba1a

Please sign in to comment.