File tree Expand file tree Collapse file tree 3 files changed +6
-10
lines changed Expand file tree Collapse file tree 3 files changed +6
-10
lines changed Original file line number Diff line number Diff line change @@ -4449,18 +4449,14 @@ pub(crate) unsafe fn rav1d_decode_frame_init(
4449
4449
if y_stride * num_lines as isize != f. lf . lr_buf_plane_sz [ 0 ] as isize
4450
4450
|| uv_stride * num_lines as isize * 2 != f. lf . lr_buf_plane_sz [ 1 ] as isize
4451
4451
{
4452
- rav1d_free_aligned ( f. lf . lr_line_buf as * mut c_void ) ;
4453
4452
// lr simd may overread the input, so slightly over-allocate the lpf buffer
4454
4453
let mut alloc_sz: usize = 128 ;
4455
4454
alloc_sz += y_stride. unsigned_abs ( ) * num_lines as usize ;
4456
4455
alloc_sz += uv_stride. unsigned_abs ( ) * num_lines as usize * 2 ;
4457
- f. lf . lr_line_buf = rav1d_alloc_aligned ( alloc_sz, 64 ) as * mut u8 ;
4458
- let mut ptr = f. lf . lr_line_buf ;
4459
- if ptr. is_null ( ) {
4460
- f. lf . lr_buf_plane_sz [ 1 ] = 0 ;
4461
- f. lf . lr_buf_plane_sz [ 0 ] = f. lf . lr_buf_plane_sz [ 1 ] ;
4462
- return Err ( ENOMEM ) ;
4463
- }
4456
+ // TODO: Fallible allocation
4457
+ // On allocation failure set `f.lf.lr_buf_plane_sz` to 0.
4458
+ f. lf . lr_line_buf . resize ( alloc_sz, 0 ) ;
4459
+ let mut ptr = f. lf . lr_line_buf . as_mut_ptr ( ) ;
4464
4460
4465
4461
ptr = ptr. offset ( 64 ) ;
4466
4462
if y_stride < 0 {
Original file line number Diff line number Diff line change @@ -461,7 +461,7 @@ pub struct Rav1dFrameContext_lf {
461
461
pub lvl : [ [ [ [ u8 ; 2 ] ; 8 ] ; 4 ] ; 8 ] , /* [8 seg_id][4 dir][8 ref][2 is_gmv] */
462
462
pub tx_lpf_right_edge : TxLpfRightEdge ,
463
463
pub cdef_line_buf : AlignedVec32 < u8 > , /* AlignedVec32<DynPixel> */
464
- pub lr_line_buf : * mut u8 ,
464
+ pub lr_line_buf : AlignedVec64 < u8 > ,
465
465
pub cdef_line : [ [ usize ; 3 ] ; 2 ] , /* [2 pre/post][3 plane] */
466
466
pub cdef_lpf_line : [ usize ; 3 ] , /* plane */
467
467
pub lr_lpf_line : [ * mut DynPixel ; 3 ] , /* plane */
Original file line number Diff line number Diff line change @@ -928,7 +928,7 @@ impl Drop for Rav1dContext {
928
928
free ( f. lf . start_of_tile_row as * mut c_void ) ;
929
929
rav1d_refmvs_clear ( & mut f. rf ) ;
930
930
let _ = mem:: take ( & mut f. lf . cdef_line_buf ) ; // TODO: remove when context is owned
931
- rav1d_free_aligned ( f. lf . lr_line_buf as * mut c_void ) ;
931
+ let _ = mem :: take ( & mut f. lf . lr_line_buf ) ; // TODO: remove when context is owned
932
932
n_1 = n_1. wrapping_add ( 1 ) ;
933
933
}
934
934
rav1d_free_aligned ( self . fc as * mut c_void ) ;
You can’t perform that action at this time.
0 commit comments