Added a "--software" option to testffmpeg

This allows easy performance comparison between hardware and software decoding
main
Sam Lantinga 2023-10-10 04:06:44 -07:00
parent 86ada8a9f0
commit adcace6f95
1 changed files with 15 additions and 10 deletions

View File

@ -69,6 +69,7 @@ static SDL_Renderer *renderer;
static SDL_AudioStream *audio; static SDL_AudioStream *audio;
static SDL_Texture *video_texture; static SDL_Texture *video_texture;
static Uint64 video_start; static Uint64 video_start;
static SDL_bool software_only;
static SDL_bool has_eglCreateImage; static SDL_bool has_eglCreateImage;
#ifdef HAVE_EGL #ifdef HAVE_EGL
static SDL_bool has_EGL_EXT_image_dma_buf_import; static SDL_bool has_EGL_EXT_image_dma_buf_import;
@ -248,20 +249,22 @@ static Uint32 GetTextureFormat(enum AVPixelFormat format)
static SDL_bool SupportedPixelFormat(enum AVPixelFormat format) static SDL_bool SupportedPixelFormat(enum AVPixelFormat format)
{ {
if (has_eglCreateImage && if (!software_only) {
(format == AV_PIX_FMT_VAAPI || format == AV_PIX_FMT_DRM_PRIME)) { if (has_eglCreateImage &&
return SDL_TRUE; (format == AV_PIX_FMT_VAAPI || format == AV_PIX_FMT_DRM_PRIME)) {
} return SDL_TRUE;
}
#ifdef __APPLE__ #ifdef __APPLE__
if (has_videotoolbox_output && format == AV_PIX_FMT_VIDEOTOOLBOX) { if (has_videotoolbox_output && format == AV_PIX_FMT_VIDEOTOOLBOX) {
return SDL_TRUE; return SDL_TRUE;
} }
#endif #endif
#ifdef __WIN32__ #ifdef __WIN32__
if (d3d11_device && format == AV_PIX_FMT_D3D11) { if (d3d11_device && format == AV_PIX_FMT_D3D11) {
return SDL_TRUE; return SDL_TRUE;
} }
#endif #endif
}
if (GetTextureFormat(format) != SDL_PIXELFORMAT_UNKNOWN) { if (GetTextureFormat(format) != SDL_PIXELFORMAT_UNKNOWN) {
return SDL_TRUE; return SDL_TRUE;
@ -789,6 +792,8 @@ int main(int argc, char *argv[])
if (SDL_strcmp(argv[i], "--sprites") == 0 && argv[i+1]) { if (SDL_strcmp(argv[i], "--sprites") == 0 && argv[i+1]) {
num_sprites = SDL_atoi(argv[i+1]); num_sprites = SDL_atoi(argv[i+1]);
++i; ++i;
} else if (SDL_strcmp(argv[i], "--software") == 0) {
software_only = SDL_TRUE;
} else { } else {
/* We'll try to open this as a media file */ /* We'll try to open this as a media file */
file = argv[i]; file = argv[i];