From patchwork Sun Aug 6 19:09:19 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Marton Balint X-Patchwork-Id: 4640 Delivered-To: ffmpegpatchwork@gmail.com Received: by 10.103.46.211 with SMTP id u202csp2007853vsu; Sun, 6 Aug 2017 12:10:03 -0700 (PDT) X-Received: by 10.28.100.136 with SMTP id y130mr6376674wmb.60.1502046603435; Sun, 06 Aug 2017 12:10:03 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1502046603; cv=none; d=google.com; s=arc-20160816; b=cd4jje7kFRs69xFi5YNeT0Lcz+jmn88AhtlrzI5zRTLMRaoaCWoeVRiKkQOet/i0G9 87FQ2JnRgr3yWMPc78EcjW/pQokwAJKmkugGfNeaV73u2OzrLECsRH0sNMjB1czk1Zlo EVJbwbM2IqDf3mgEhRZWMT9ZX+Cp2/Ag9JVay9WozfEyrjOnBt0iKHxUMkyIXGOqcN7t 7YWnmG8+BXY/cBxLK0rI4jEDCVfpMgHryDJ8xriWAqmY3fhADFEq4Usu19rWF0SyavEF 225T33fk2ictM2stDIuoHFb/RayYniBpTnTRtDiIShBCR/1/l04GhK1kvhnEtfQ40fb7 39eg== 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:message-id:date:to:from:delivered-to :arc-authentication-results; bh=0wYQUfnc6qMtPbITX0Y0K97OpqkgOmTJSJVEIEY5ycI=; b=Ux3SMOqk/udIzh7u2sRFkOGWXWW9+FgmXcFJIzWj8gZdef/raQEQ/crSTiR6Uq3XPP F4dXWzeW1xvkJ8IZts1go5LcEr7KukZjpGBAW0FoEwUJa20jGbZEWbUlEyu38gT0CpPb lxz0mGTL+VFm63822c3MPESmNbokzbrG98U/FO7DTHZmlpZNd5ZpUH2Gr1nNActWbDtA BBD1nkmYIvsNZ45w78YvSWgfexVTkahm9/4/ycSfXPIoRJePGuVry2XkgHRMAyL+Alv/ 41ERPl2xkodkAZHPvYPsirOTbwDxssTuCeTqzrY6XN5e8xADGoY7sIyJdcbQl8cvFa1p Mohw== 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 i18si7248325wra.141.2017.08.06.12.10.02; Sun, 06 Aug 2017 12:10:03 -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 DAC38689889; Sun, 6 Aug 2017 22:09:58 +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 DA750689755 for ; Sun, 6 Aug 2017 22:09:51 +0300 (EEST) Received: from localhost (localhost [127.0.0.1]) by iq.passwd.hu (Postfix) with ESMTP id C914A102F15; Sun, 6 Aug 2017 21:09:52 +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 8BQZhB-Izbeg; Sun, 6 Aug 2017 21:09:51 +0200 (CEST) Received: from bluegene.passwd.hu (localhost [127.0.0.1]) by iq.passwd.hu (Postfix) with ESMTP id 6C7E2102EB5; Sun, 6 Aug 2017 21:09:51 +0200 (CEST) From: Marton Balint To: ffmpeg-devel@ffmpeg.org Date: Sun, 6 Aug 2017 21:09:19 +0200 Message-Id: <20170806190921.10897-1-cus@passwd.hu> X-Mailer: git-send-email 2.13.1 Subject: [FFmpeg-devel] [PATCH 1/3] ffplay: add support for rendering yuv images with negative line size 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" Signed-off-by: Marton Balint --- ffplay.c | 15 ++++++++++----- 1 file changed, 10 insertions(+), 5 deletions(-) diff --git a/ffplay.c b/ffplay.c index 7cc5ab1644..ee3d1628e8 100644 --- a/ffplay.c +++ b/ffplay.c @@ -859,13 +859,18 @@ static int upload_texture(SDL_Texture *tex, AVFrame *frame, struct SwsContext ** int ret = 0; switch (frame->format) { case AV_PIX_FMT_YUV420P: - if (frame->linesize[0] < 0 || frame->linesize[1] < 0 || frame->linesize[2] < 0) { - av_log(NULL, AV_LOG_ERROR, "Negative linesize is not supported for YUV.\n"); + if (frame->linesize[0] > 0 && frame->linesize[1] > 0 && frame->linesize[2] > 0) { + ret = SDL_UpdateYUVTexture(tex, NULL, frame->data[0], frame->linesize[0], + frame->data[1], frame->linesize[1], + frame->data[2], frame->linesize[2]); + } else if (frame->linesize[0] < 0 && frame->linesize[1] < 0 && frame->linesize[2] < 0) { + ret = SDL_UpdateYUVTexture(tex, NULL, frame->data[0] + frame->linesize[0] * (frame->height - 1), -frame->linesize[0], + frame->data[1] + frame->linesize[1] * (AV_CEIL_RSHIFT(frame->height, 1) - 1), -frame->linesize[1], + frame->data[2] + frame->linesize[2] * (AV_CEIL_RSHIFT(frame->height, 1) - 1), -frame->linesize[2]); + } else { + av_log(NULL, AV_LOG_ERROR, "Mixed negative and positive linesizes are not supported.\n"); return -1; } - ret = SDL_UpdateYUVTexture(tex, NULL, frame->data[0], frame->linesize[0], - frame->data[1], frame->linesize[1], - frame->data[2], frame->linesize[2]); break; case AV_PIX_FMT_BGRA: if (frame->linesize[0] < 0) {