@@ -1779,7 +1779,8 @@ fn mc<BD: BitDepth>(
1779
1779
) ;
1780
1780
let stride = 192 ;
1781
1781
Rav1dPictureDataComponentOffset {
1782
- data : & Rav1dPictureDataComponent :: wrap_buf :: < BD > ( emu_edge_buf, stride) ,
1782
+ // SAFETY: Lifetime extension forces `buf` to outlive it.
1783
+ data : & unsafe { Rav1dPictureDataComponent :: wrap_buf :: < BD > ( emu_edge_buf, stride) } ,
1783
1784
offset : stride * ( my != 0 ) as usize * 3 + ( mx != 0 ) as usize * 3 ,
1784
1785
}
1785
1786
} else {
@@ -1852,7 +1853,8 @@ fn mc<BD: BitDepth>(
1852
1853
}
1853
1854
let stride = 320 ;
1854
1855
Rav1dPictureDataComponentOffset {
1855
- data : & Rav1dPictureDataComponent :: wrap_buf :: < BD > ( emu_edge_buf, stride) ,
1856
+ // SAFETY: Lifetime extension forces `buf` to outlive it.
1857
+ data : & unsafe { Rav1dPictureDataComponent :: wrap_buf :: < BD > ( emu_edge_buf, stride) } ,
1856
1858
offset : stride * 3 + 3 ,
1857
1859
}
1858
1860
} else {
@@ -1920,10 +1922,13 @@ fn obmc<BD: BitDepth>(
1920
1922
t. b ,
1921
1923
MaybeTempPixels :: NonTemp {
1922
1924
dst : Rav1dPictureDataComponentOffset {
1923
- data : & Rav1dPictureDataComponent :: wrap_buf :: < BD > (
1924
- lap,
1925
- ow4 as usize * h_mul as usize ,
1926
- ) ,
1925
+ // SAFETY: Lifetime extension forces `buf` to outlive it.
1926
+ data : & unsafe {
1927
+ Rav1dPictureDataComponent :: wrap_buf :: < BD > (
1928
+ lap,
1929
+ ow4 as usize * h_mul as usize ,
1930
+ )
1931
+ } ,
1927
1932
offset : 0 ,
1928
1933
} ,
1929
1934
} ,
@@ -1968,10 +1973,13 @@ fn obmc<BD: BitDepth>(
1968
1973
t. b ,
1969
1974
MaybeTempPixels :: NonTemp {
1970
1975
dst : Rav1dPictureDataComponentOffset {
1971
- data : & Rav1dPictureDataComponent :: wrap_buf :: < BD > (
1972
- lap,
1973
- ow4 as usize * h_mul as usize ,
1974
- ) ,
1976
+ // SAFETY: Lifetime extension forces `buf` to outlive it.
1977
+ data : & unsafe {
1978
+ Rav1dPictureDataComponent :: wrap_buf :: < BD > (
1979
+ lap,
1980
+ ow4 as usize * h_mul as usize ,
1981
+ )
1982
+ } ,
1975
1983
offset : 0 ,
1976
1984
} ,
1977
1985
} ,
@@ -2056,7 +2064,10 @@ fn warp_affine<BD: BitDepth>(
2056
2064
) ;
2057
2065
let stride = 32 ;
2058
2066
Rav1dPictureDataComponentOffset {
2059
- data : & Rav1dPictureDataComponent :: wrap_buf :: < BD > ( emu_edge_buf, stride) ,
2067
+ // SAFETY: Lifetime extension forces `buf` to outlive it.
2068
+ data : & unsafe {
2069
+ Rav1dPictureDataComponent :: wrap_buf :: < BD > ( emu_edge_buf, stride)
2070
+ } ,
2060
2071
offset : stride * 3 + 3 ,
2061
2072
}
2062
2073
} else {
@@ -3123,7 +3134,10 @@ pub(crate) fn rav1d_recon_b_inter<BD: BitDepth>(
3123
3134
let tmp = interintra_edge_pal. interintra . buf_mut :: < BD > ( ) ;
3124
3135
f. dsp . ipred . intra_pred [ m as usize ] . call (
3125
3136
Rav1dPictureDataComponentOffset {
3126
- data : & Rav1dPictureDataComponent :: wrap_buf :: < BD > ( tmp, 4 * bw4 as usize ) ,
3137
+ // SAFETY: Lifetime extension forces `buf` to outlive it.
3138
+ data : & unsafe {
3139
+ Rav1dPictureDataComponent :: wrap_buf :: < BD > ( tmp, 4 * bw4 as usize )
3140
+ } ,
3127
3141
offset : 0 ,
3128
3142
} ,
3129
3143
tl_edge_array,
@@ -3407,10 +3421,13 @@ pub(crate) fn rav1d_recon_b_inter<BD: BitDepth>(
3407
3421
let tmp = interintra_edge_pal. interintra . buf_mut :: < BD > ( ) ;
3408
3422
f. dsp . ipred . intra_pred [ m as usize ] . call (
3409
3423
Rav1dPictureDataComponentOffset {
3410
- data : & Rav1dPictureDataComponent :: wrap_buf :: < BD > (
3411
- tmp,
3412
- 4 * cbw4 as usize ,
3413
- ) ,
3424
+ // SAFETY: Lifetime extension forces `buf` to outlive it.
3425
+ data : & unsafe {
3426
+ Rav1dPictureDataComponent :: wrap_buf :: < BD > (
3427
+ tmp,
3428
+ 4 * cbw4 as usize ,
3429
+ )
3430
+ } ,
3414
3431
offset : 0 ,
3415
3432
} ,
3416
3433
tl_edge_array,
0 commit comments