From patchwork Wed May 9 05:50:23 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jerome Borsboom X-Patchwork-Id: 8890 Delivered-To: ffmpegpatchwork@gmail.com Received: by 2002:a02:155:0:0:0:0:0 with SMTP id c82-v6csp4810111jad; Tue, 8 May 2018 22:50:34 -0700 (PDT) X-Google-Smtp-Source: AB8JxZpi1HVM6JEWFJ3vcEvTe/0oyj86U+8eWjgsopo3QvsHQDi23tO7Z9ibm5uU4QBcaoh8X0gG X-Received: by 2002:adf:988c:: with SMTP id w12-v6mr33619515wrb.215.1525845034814; Tue, 08 May 2018 22:50:34 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1525845034; cv=none; d=google.com; s=arc-20160816; b=hwg2MugVljE/I9W47yOnsMZkAviKGE+2xPw94E4Di7QxrP7Vd3L/YRuG4aQnccPz0z hR4IpW+1KqkBVWAzSwDB/E5ORwLj8j7Vhf9Y56SuY4PZzp5aIMn/AoyGjxWOlC6ALCp7 k1faumxxhLcdPZbsFoB9oqpQ7/bcq+1CDffQ1+rwpbBTQStTaa9avLXMDU6EjqbU4J1i yl/sHgQASAz/wj2MdNGAFUyhz7Iu3JW9m+3fvJrgcZe3/nDWj5JCMgVDG6pFAfNPjJmf RzBiXqtBjEjtEfm5rnwQ+5u15nYXmw9L08KxMw2M29BlKFUgWz9C+GslE1srjBa2SZh8 5N2Q== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:content-transfer-encoding:reply-to:list-subscribe :list-help:list-post:list-archive:list-unsubscribe:list-id :precedence:subject:content-language:mime-version:user-agent:date :message-id:from:to:dkim-signature:delivered-to :arc-authentication-results; bh=1blLcnt790CiBu/OIx0xKCxuBvT5yLAwaT52g1mcDAs=; b=facdXPmAGPfY+3fDYJmwqZ03IPU7uoB1U7TcUxtlt4t5j6q2hVp363VQ2WsDhHSXc5 r6IFDvuRI3u69WRbhLaqkRV5s5XRMq8XrPnzAutSVH58xUB63QHgqce9Y3S8i4atC57V C1tBeEPMGZjki2LzP8aLVhzPUH8avL5zcf6rKv0WhYlOFgFzDhoyvWBNGAxjF/mXyYBq mSHIWp45s7DHzWkfu67ejEzZqHt1c03CdJM96cYFwsRIvzEMzbAgGWTaAyqFsDmKUsIF dx/WjEfdygUpWZ9vaIJMoRvu0DgT+gnDX/K+bizIc9SvPANz8AvMod9F8Hs93cGv8VyH GXVw== ARC-Authentication-Results: i=1; mx.google.com; dkim=neutral (body hash did not verify) header.i=@carpalis.nl header.s=default header.b=U1dus1v4; 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 m5si7029095wme.8.2018.05.08.22.50.33; Tue, 08 May 2018 22:50:34 -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; dkim=neutral (body hash did not verify) header.i=@carpalis.nl header.s=default header.b=U1dus1v4; 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 94CF268A3B1; Wed, 9 May 2018 08:49:55 +0300 (EEST) X-Original-To: ffmpeg-devel@ffmpeg.org Delivered-To: ffmpeg-devel@ffmpeg.org Received: from kyoto.xs4all.nl (kyoto.xs4all.nl [83.161.153.34]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id BFA9468A358 for ; Wed, 9 May 2018 08:49:49 +0300 (EEST) Received: from [10.10.7.135] ([212.205.49.114]) (authenticated bits=0) by kyoto.xs4all.nl (8.14.7/8.14.7) with ESMTP id w495oMqL001514 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO) for ; Wed, 9 May 2018 07:50:23 +0200 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=carpalis.nl; s=default; t=1525845024; bh=OwrMLXEhNuR6aC9XDBuz2DDlVc4hTdfFVeGAyF2VdcY=; h=To:From:Subject:Date; b=U1dus1v4e8y56nrbaJkrLmJnp2KzmyAr2+IFXEnC8QqDcucyU/MfrHzGb0G3/002B 9czt/o6UtDAyMMasyQOS88SZY0njZ6MN1BO/5RH51B6rNLcynvKw+yDjU8oN21yE6D IyNWcAdgeAQZ9bcxPZhbqVszVLmdeof3B3AxZHUFoK7eRiTzNT2+ZDyw315V/kmBZY qsD9Ksx/FkcvRbfPB/2t+b0jJ0Ohc8Gu0qzqKxkkQOV8skloa56Hxx3y5ZFoAWLY5F oHZXPUTjtMndtBrVPGo2+39NVPVp8TtmIuPg9OWf8JmeN20fvMR/2Ti28NjUostkKN 1oIR0h5WkI5gw== To: ffmpeg-devel@ffmpeg.org From: Jerome Borsboom Message-ID: Date: Wed, 9 May 2018 07:50:23 +0200 User-Agent: Mozilla/5.0 (Windows NT 6.1; WOW64; rv:52.0) Gecko/20100101 Thunderbird/52.7.0 MIME-Version: 1.0 Content-Language: nl Subject: [FFmpeg-devel] [PATCH 1/2] avcodec/vaapi: slice_vertical_position starts from zero for the second field 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 Errors-To: ffmpeg-devel-bounces@ffmpeg.org Sender: "ffmpeg-devel" Contrary to VC-1 spec, VAAPI expects the row address of the first macroblock row in the first slice to start from zero for the second field in a field interlaced picture. Signed-off-by: Jerome Borsboom --- This patch set adds support for hardware decoding multi-slice field interlaced pictures. With this patch set, the SA10180 test file decodes correctly with VAAPI hardware acceleration. This was succesfully tested on Intel Haswell platform. libavcodec/vaapi_vc1.c | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/libavcodec/vaapi_vc1.c b/libavcodec/vaapi_vc1.c index bdb5e24cc5..921ca6391b 100644 --- a/libavcodec/vaapi_vc1.c +++ b/libavcodec/vaapi_vc1.c @@ -467,6 +467,7 @@ static int vaapi_vc1_decode_slice(AVCodecContext *avctx, const uint8_t *buffer, const MpegEncContext *s = &v->s; VAAPIDecodePicture *pic = s->current_picture_ptr->hwaccel_picture_private; VASliceParameterBufferVC1 slice_param; + int mb_height; int err; /* Current bit buffer is beyond any marker for VC-1, so skip it */ @@ -475,12 +476,17 @@ static int vaapi_vc1_decode_slice(AVCodecContext *avctx, const uint8_t *buffer, size -= 4; } + if (v->fcm == ILACE_FIELD) + mb_height = avctx->coded_height + 31 >> 5; + else + mb_height = avctx->coded_height + 15 >> 4; + slice_param = (VASliceParameterBufferVC1) { .slice_data_size = size, .slice_data_offset = 0, .slice_data_flag = VA_SLICE_DATA_FLAG_ALL, .macroblock_offset = get_bits_count(&s->gb), - .slice_vertical_position = s->mb_y, + .slice_vertical_position = s->mb_y % mb_height, }; err = ff_vaapi_decode_make_slice_buffer(avctx, pic,