@@ -6,7 +6,7 @@ from av.enum cimport define_enum
6
6
from av.error cimport err_check
7
7
from av.utils cimport check_ndarray, check_ndarray_shape
8
8
from av.video.format cimport get_pix_fmt, get_video_format
9
- from av.video.plane cimport VideoPlane, YUVPlanes
9
+ from av.video.plane cimport VideoPlane
10
10
11
11
import warnings
12
12
@@ -303,21 +303,11 @@ cdef class VideoFrame(Frame):
303
303
if frame.format.name in (" yuv420p" , " yuvj420p" ):
304
304
assert frame.width % 2 == 0
305
305
assert frame.height % 2 == 0
306
- # Fast path for the case that the entire YUV data is contiguous
307
- if (
308
- frame.planes[0 ].line_size == frame.planes[0 ].width and
309
- frame.planes[1 ].line_size == frame.planes[1 ].width and
310
- frame.planes[2 ].line_size == frame.planes[2 ].width
311
- ):
312
- yuv_planes = YUVPlanes(frame, 0 )
313
- return useful_array(yuv_planes).reshape(frame.height * 3 // 2 , frame.width)
314
- else :
315
- # Otherwise, we need to copy the data through the use of np.hstack
316
- return np.hstack((
317
- useful_array(frame.planes[0 ]),
318
- useful_array(frame.planes[1 ]),
319
- useful_array(frame.planes[2 ])
320
- )).reshape(- 1 , frame.width)
306
+ return np.hstack((
307
+ useful_array(frame.planes[0 ]),
308
+ useful_array(frame.planes[1 ]),
309
+ useful_array(frame.planes[2 ])
310
+ )).reshape(- 1 , frame.width)
321
311
elif frame.format.name in (" yuv444p" , " yuvj444p" ):
322
312
return np.hstack((
323
313
useful_array(frame.planes[0 ]),
0 commit comments