From patchwork Sat Oct 28 21:05:16 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Marton Balint X-Patchwork-Id: 5734 Delivered-To: ffmpegpatchwork@gmail.com Received: by 10.2.161.90 with SMTP id m26csp978901jah; Sat, 28 Oct 2017 14:05:38 -0700 (PDT) X-Google-Smtp-Source: ABhQp+Q0MBmK+2gWt9Uxfd0MsWYogR2ZIU4g6KxM3QnZFq52HE7zNcEGpHO5SHkd9SbTdVruvYI1 X-Received: by 10.223.163.143 with SMTP id l15mr4037972wrb.149.1509224738296; Sat, 28 Oct 2017 14:05:38 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1509224738; cv=none; d=google.com; s=arc-20160816; b=kJZr+cbFyWp/N0XDwOU23kT5tvbRDr8fFJqdnsOdoQx/iSjNkAOZiyBlf1DjRIfBFq SdetUwyGZaDehaK1s80Da/aiqaY/QDqG9ub5BmrquRjZ1Ox2/RF8slhb0eZnJ+C0uKDj P3UF6pwOTVLD4R46Vi9o3aT8da4ZNNV4KKoOXQFpMNsFh/vrWxjRNWwpYQ5KjxG0NLjU 4Bz+lvrXF3CMSP6slpquM9KcHZg53M+tq8B1pnwY0FtfjlE9/jXVGPD9JjIEBC9ELlCJ S97HDMwsKbqD2ltrHEn5R5p0pJ9/+pLlBU2WtYU1BQtRIUj8RVe9Tbfkbdu2p8QaNKDI llSg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:content-transfer-encoding:mime-version:cc:reply-to :list-subscribe:list-help:list-post:list-archive:list-unsubscribe :list-id:precedence:subject:references:in-reply-to:message-id:date :to:from:delivered-to:arc-authentication-results; bh=rihn+0afRB6enQamQu+rrrt2Gf2Xz2A7ZZb7nnRpHdM=; b=NzkL5tl+qsm3NythqUF9lbh5nXMWMXauhWxRKdb8ttcL7rdjiKOUhF8xbJx9ekeNvI aCflKIpcPCoslnCYeFVm4H2abXmw7skxTxU0r6dfLOWptsG6k/SgQD8wMbfzZ1/GgCMx qCThV9YatgMBdZwLni8GSuMk4/cD25jrOckEa5MdKWJJwVvsW3fKnGmu0bLX1ys4J5+9 f8LCx+kl88HmI+3Yh79oElPH6niap6+utvwIdxnl4pEG7qP1qvyQpkEBDcHvdFK+Y0xt iIfFqiUfNb0YQfpNaVC51k1BWEe2SlfkbQKU4vqCkx27qPzE5VG+F6Ul3oJs/eTjENth 2/bw== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of ffmpeg-devel-bounces@ffmpeg.org designates 79.124.17.100 as permitted sender) smtp.mailfrom=ffmpeg-devel-bounces@ffmpeg.org Return-Path: Received: from ffbox0-bg.mplayerhq.hu (ffbox0-bg.ffmpeg.org. [79.124.17.100]) by mx.google.com with ESMTP id d54si7892684wrd.331.2017.10.28.14.05.37; Sat, 28 Oct 2017 14:05:38 -0700 (PDT) Received-SPF: pass (google.com: domain of ffmpeg-devel-bounces@ffmpeg.org designates 79.124.17.100 as permitted sender) client-ip=79.124.17.100; Authentication-Results: mx.google.com; spf=pass (google.com: domain of ffmpeg-devel-bounces@ffmpeg.org designates 79.124.17.100 as permitted sender) smtp.mailfrom=ffmpeg-devel-bounces@ffmpeg.org Received: from [127.0.1.1] (localhost [127.0.0.1]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTP id D473568A442; Sun, 29 Oct 2017 00:05:24 +0300 (EEST) X-Original-To: ffmpeg-devel@ffmpeg.org Delivered-To: ffmpeg-devel@ffmpeg.org Received: from iq.passwd.hu (iq.passwd.hu [217.27.212.140]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTP id 52AEA68A425 for ; Sun, 29 Oct 2017 00:05:18 +0300 (EEST) Received: from localhost (localhost [127.0.0.1]) by iq.passwd.hu (Postfix) with ESMTP id 4CF8DE1609; Sat, 28 Oct 2017 23:05:27 +0200 (CEST) X-Virus-Scanned: amavisd-new at passwd.hu Received: from iq.passwd.hu ([127.0.0.1]) by localhost (iq.passwd.hu [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id WY_rTkM2gBYr; Sat, 28 Oct 2017 23:05:26 +0200 (CEST) Received: from bluegene.passwd.hu (localhost [127.0.0.1]) by iq.passwd.hu (Postfix) with ESMTP id EF4FDE15F6; Sat, 28 Oct 2017 23:05:25 +0200 (CEST) From: Marton Balint To: ffmpeg-devel@ffmpeg.org Date: Sat, 28 Oct 2017 23:05:16 +0200 Message-Id: <20171028210516.20880-2-cus@passwd.hu> X-Mailer: git-send-email 2.13.6 In-Reply-To: <20171028210516.20880-1-cus@passwd.hu> References: <20171028210516.20880-1-cus@passwd.hu> Subject: [FFmpeg-devel] [PATCH 2/2] ffplay: only use hardware accelerated SDL texture formats X-BeenThere: ffmpeg-devel@ffmpeg.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: FFmpeg development discussions and patches List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Reply-To: FFmpeg development discussions and patches Cc: Marton Balint MIME-Version: 1.0 Errors-To: ffmpeg-devel-bounces@ffmpeg.org Sender: "ffmpeg-devel" Typically only a small subset of the SDL texture formats are supported directly by the SDL renderer drivers, the rest is software emulated. It's better if libswscale does the format conversion to a hardware-accelerated texture format instead of SDL. This should fix video render slowdowns with some texture formats after 3bd2228d05a05eab5f91ac00b01efac9cb07649b. Signed-off-by: Marton Balint --- fftools/ffplay.c | 16 ++++++++++++---- 1 file changed, 12 insertions(+), 4 deletions(-) diff --git a/fftools/ffplay.c b/fftools/ffplay.c index bebc2b392b..4e1ff62dc4 100644 --- a/fftools/ffplay.c +++ b/fftools/ffplay.c @@ -1828,10 +1828,18 @@ static int configure_video_filters(AVFilterGraph *graph, VideoState *is, const c AVCodecParameters *codecpar = is->video_st->codecpar; AVRational fr = av_guess_frame_rate(is->ic, is->video_st, NULL); AVDictionaryEntry *e = NULL; - int i; + int nb_pix_fmts = 0; + int i, j; - for (i = 0; i < FF_ARRAY_ELEMS(pix_fmts); i++) - pix_fmts[i] = sdl_texture_format_map[i].format; + for (i = 0; i < renderer_info.num_texture_formats; i++) { + for (j = 0; j < FF_ARRAY_ELEMS(sdl_texture_format_map) - 1; j++) { + if (renderer_info.texture_formats[i] == sdl_texture_format_map[j].texture_fmt) { + pix_fmts[nb_pix_fmts++] = sdl_texture_format_map[j].format; + break; + } + } + } + pix_fmts[nb_pix_fmts] = AV_PIX_FMT_NONE; while ((e = av_dict_get(sws_dict, "", e, AV_DICT_IGNORE_SUFFIX))) { if (!strcmp(e->key, "sws_flags")) { @@ -3741,7 +3749,7 @@ int main(int argc, char **argv) av_log(NULL, AV_LOG_VERBOSE, "Initialized %s renderer.\n", renderer_info.name); } } - if (!window || !renderer) { + if (!window || !renderer || !renderer_info.num_texture_formats) { av_log(NULL, AV_LOG_FATAL, "Failed to create window or renderer: %s", SDL_GetError()); exit(1); }