Commit 066dc71d authored by Rémi Denis-Courmont's avatar Rémi Denis-Courmont

avcodec: split generic YV12/NV12 copy out of SSE2 functions

This is required by the next commit. This also avoids making two copies
on non-x86 platforms, where USWC optimizations are irrelevant.
(cherry picked from commit 07d8e576c7a0dcc7863d6853f620d5a99ebba55f)

Conflicts:
	modules/codec/avcodec/copy.c
parent 69eb62b3
This diff is collapsed.
...@@ -25,8 +25,10 @@ ...@@ -25,8 +25,10 @@
#define _VLC_AVCODEC_COPY_H 1 #define _VLC_AVCODEC_COPY_H 1
typedef struct { typedef struct {
# ifdef CAN_COMPILE_SSE2
uint8_t *buffer; uint8_t *buffer;
size_t size; size_t size;
# endif
} copy_cache_t; } copy_cache_t;
int CopyInitCache(copy_cache_t *cache, unsigned width); int CopyInitCache(copy_cache_t *cache, unsigned width);
......
...@@ -310,7 +310,8 @@ static int CreateSurfaces( vlc_va_vaapi_t *p_va, void **pp_hw_ctx, vlc_fourcc_t ...@@ -310,7 +310,8 @@ static int CreateSurfaces( vlc_va_vaapi_t *p_va, void **pp_hw_ctx, vlc_fourcc_t
goto error; goto error;
*pi_chroma = i_chroma; *pi_chroma = i_chroma;
CopyInitCache( &p_va->image_cache, i_width ); if( unlikely(CopyInitCache( &p_va->image_cache, i_width )) )
goto error;
/* Setup the ffmpeg hardware context */ /* Setup the ffmpeg hardware context */
*pp_hw_ctx = &p_va->hw_ctx; *pp_hw_ctx = &p_va->hw_ctx;
...@@ -358,9 +359,6 @@ static int Extract( vlc_va_t *p_external, picture_t *p_picture, AVFrame *p_ff ) ...@@ -358,9 +359,6 @@ static int Extract( vlc_va_t *p_external, picture_t *p_picture, AVFrame *p_ff )
{ {
vlc_va_vaapi_t *p_va = vlc_va_vaapi_Get(p_external); vlc_va_vaapi_t *p_va = vlc_va_vaapi_Get(p_external);
if( !p_va->image_cache.buffer )
return VLC_EGENERIC;
VASurfaceID i_surface_id = (VASurfaceID)(uintptr_t)p_ff->data[3]; VASurfaceID i_surface_id = (VASurfaceID)(uintptr_t)p_ff->data[3];
#if VA_CHECK_VERSION(0,31,0) #if VA_CHECK_VERSION(0,31,0)
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment