@@ -6,7 +6,7 @@ from av.enum cimport define_enum
66from av.error cimport err_check
77from av.utils cimport check_ndarray, check_ndarray_shape
88from 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
1010
1111import warnings
1212
@@ -303,21 +303,11 @@ cdef class VideoFrame(Frame):
303303 if frame.format.name in (" yuv420p" , " yuvj420p" ):
304304 assert frame.width % 2 == 0
305305 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)
321311 elif frame.format.name in (" yuv444p" , " yuvj444p" ):
322312 return np.hstack((
323313 useful_array(frame.planes[0 ]),
0 commit comments