From patchwork Thu Aug 4 00:48:56 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: James Almer X-Patchwork-Id: 86 X-Patchwork-Delegate: jamrial@gmail.com Delivered-To: ffmpegpatchwork@gmail.com Received: by 10.103.140.67 with SMTP id o64csp961664vsd; Wed, 3 Aug 2016 18:16:24 -0700 (PDT) X-Received: by 10.194.75.198 with SMTP id e6mr64218429wjw.31.1470273383982; Wed, 03 Aug 2016 18:16:23 -0700 (PDT) Return-Path: Received: from ffbox0-bg.mplayerhq.hu (ffbox0-bg.ffmpeg.org. [79.124.17.100]) by mx.google.com with ESMTP id 1si1210276wmm.23.2016.08.03.18.16.23; Wed, 03 Aug 2016 18:16:23 -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=@gmail.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; dmarc=fail (p=NONE dis=NONE) header.from=gmail.com Received: from [127.0.1.1] (localhost [127.0.0.1]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTP id 8AE5D68A382; Thu, 4 Aug 2016 04:16:10 +0300 (EEST) X-Original-To: ffmpeg-devel@ffmpeg.org Delivered-To: ffmpeg-devel@ffmpeg.org Received: from mail-oi0-f52.google.com (mail-oi0-f52.google.com [209.85.218.52]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id 39F4F68A320 for ; Thu, 4 Aug 2016 03:49:03 +0300 (EEST) Received: by mail-oi0-f52.google.com with SMTP id 4so94108669oih.2 for ; Wed, 03 Aug 2016 17:49:09 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=subject:to:references:from:message-id:date:user-agent:mime-version :in-reply-to; bh=r6+3di2D8OWfo/0H0PQRpCpKR+/MxYa2Mlz2I8pniiU=; b=jN/8QZuf88Wwo+oPW5XUCHsmcjOkYrGHYfxzSUF48lamiiytQFXdsBBhEtglcpzo4f jg8SQFiI38Dm+R7zRlKoFCy/LLebY/eGbQ41JCIzRme8AqPE/wXd+ACtFnCPY7QGHKLh wyYz5i2Ba3pOlTLWmy7/ka/IUQLQvCYD9zoeirrVPM5n7BkRKG63jWnsmnbqrq1cmtb6 OQPcnWIHm4AyCLy66MxuxiD8rGth/qxu3mLZtNmaJuDMU/AGQ5BCO/6TjQS7MoSD6cKc Ej4QDSmUQlgOmjNGeNJHGH4nCB0pPcqinXgUBt/qLtLfyo8GKMIXwJye8xqRROmED0jQ APJg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:subject:to:references:from:message-id:date :user-agent:mime-version:in-reply-to; bh=r6+3di2D8OWfo/0H0PQRpCpKR+/MxYa2Mlz2I8pniiU=; b=DlpE5JliLOEk1NmcH7+p0S1iVWy6092nSEyDMipNMPcjgkBv6uV/GTsZvkMBAHMkcF tbkU0pfQwFJnI8SujleNK8kUzUnsP37xwkjm1GmEAQpr2+im3uLLOhzJAcXsrPEZlGKC lOfISwwYEWc1RD56xcO4X1vO3lg5qDCa8CyyCD7wdg7mnN67BILGg7+ZoYA6HrqpF9mn 9g92HfGNa+VJ8LPQKDwbMpKY+UvZo/cs/cddiY4XtTIoqP/X2M9sHnnTQPjCcLPsCIAY LGtBbe1W0MA/VDzT1OBrOsNpmFBYxkV2/xNDzWSBWmvRn+S6FLaoYbDJXXkr8G3ITFPk Nmtw== X-Gm-Message-State: AEkoous57cwZn9lFl3v42q2hMd1oTKlzEL8FKlD+MIrCaKUCjPQ46CW8zmP0Ac0CEUjxdg== X-Received: by 10.157.52.176 with SMTP id g45mr3468572otc.195.1470271748385; Wed, 03 Aug 2016 17:49:08 -0700 (PDT) Received: from [192.168.1.33] ([181.22.53.218]) by smtp.googlemail.com with ESMTPSA id e61sm5050980otb.21.2016.08.03.17.49.06 for (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 03 Aug 2016 17:49:07 -0700 (PDT) To: FFmpeg development discussions and patches References: <20160803223324.5844-1-jamrial@gmail.com> <4c553768-aa5a-7dbc-2a12-ed33e8bcbdc9@gmail.com> From: James Almer Message-ID: <8f5e81f3-4982-5236-616c-3a5a242a14c4@gmail.com> Date: Wed, 3 Aug 2016 21:48:56 -0300 User-Agent: Mozilla/5.0 (Windows NT 10.0; WOW64; rv:45.0) Gecko/20100101 Thunderbird/45.2.0 MIME-Version: 1.0 In-Reply-To: <4c553768-aa5a-7dbc-2a12-ed33e8bcbdc9@gmail.com> Subject: Re: [FFmpeg-devel] [PATCH] avcodec: don't include vdpau_compat.h when vdpau is not enabled 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" On 8/3/2016 8:35 PM, James Almer wrote: > On 8/3/2016 7:59 PM, Carl Eugen Hoyos wrote: >> Hi! >> >> 2016-08-04 0:33 GMT+02:00 James Almer : >>> This removes unnecessary header dependencies. >> >> Why is this an advantage? > > h263, vc1 and mpeg decoder were pointlessly pulling the entire set > of h264 headers because of it. > >> >>> 5 files changed, 25 insertions(+), 20 deletions(-) >> >> This doesn't imply a simplification... Is this one better? From bb2ccb375ad7edc4fd7fbb8d6d4a2d36e15d0b5c Mon Sep 17 00:00:00 2001 From: James Almer Date: Wed, 3 Aug 2016 21:32:20 -0300 Subject: [PATCH] avcodec/vdpau_compat: Include headers as needed Signed-off-by: James Almer --- libavcodec/h263dec.c | 4 ++-- libavcodec/h264_picture.c | 10 ++++------ libavcodec/h264dec.c | 11 +++++------ libavcodec/mpeg12dec.c | 5 ++--- libavcodec/vc1dec.c | 5 ++--- libavcodec/vdpau_compat.h | 3 +++ 6 files changed, 18 insertions(+), 20 deletions(-) diff --git a/libavcodec/h263dec.c b/libavcodec/h263dec.c index d0da1d3..f412961 100644 --- a/libavcodec/h263dec.c +++ b/libavcodec/h263dec.c @@ -603,8 +603,8 @@ retry: if (!s->divx_packed && !avctx->hwaccel) ff_thread_finish_setup(avctx); -#if FF_API_CAP_VDPAU - if (CONFIG_MPEG4_VDPAU_DECODER && (s->avctx->codec->capabilities & AV_CODEC_CAP_HWACCEL_VDPAU)) { +#if FF_API_CAP_VDPAU && CONFIG_MPEG4_VDPAU_DECODER + if (s->avctx->codec->capabilities & AV_CODEC_CAP_HWACCEL_VDPAU) { ff_vdpau_mpeg4_decode_picture(avctx->priv_data, s->gb.buffer, s->gb.buffer_end - s->gb.buffer); goto frame_end; } diff --git a/libavcodec/h264_picture.c b/libavcodec/h264_picture.c index f634d2a..7060dbc 100644 --- a/libavcodec/h264_picture.c +++ b/libavcodec/h264_picture.c @@ -156,9 +156,8 @@ int ff_h264_field_end(H264Context *h, H264SliceContext *sl, int in_setup) int err = 0; h->mb_y = 0; -#if FF_API_CAP_VDPAU - if (CONFIG_H264_VDPAU_DECODER && - h->avctx->codec->capabilities & AV_CODEC_CAP_HWACCEL_VDPAU) +#if FF_API_CAP_VDPAU && CONFIG_H264_VDPAU_DECODER + if (h->avctx->codec->capabilities & AV_CODEC_CAP_HWACCEL_VDPAU) ff_vdpau_h264_set_reference_frames(h); #endif @@ -179,9 +178,8 @@ int ff_h264_field_end(H264Context *h, H264SliceContext *sl, int in_setup) "hardware accelerator failed to decode picture\n"); } -#if FF_API_CAP_VDPAU - if (CONFIG_H264_VDPAU_DECODER && - h->avctx->codec->capabilities & AV_CODEC_CAP_HWACCEL_VDPAU) +#if FF_API_CAP_VDPAU && CONFIG_H264_VDPAU_DECODER + if (h->avctx->codec->capabilities & AV_CODEC_CAP_HWACCEL_VDPAU) ff_vdpau_h264_picture_complete(h); #endif diff --git a/libavcodec/h264dec.c b/libavcodec/h264dec.c index 323639d..f9188c3 100644 --- a/libavcodec/h264dec.c +++ b/libavcodec/h264dec.c @@ -50,6 +50,7 @@ #include "mathops.h" #include "me_cmp.h" #include "mpegutils.h" +#include "mpegvideo.h" #include "profiles.h" #include "rectangle.h" #include "thread.h" @@ -844,9 +845,8 @@ again: if (h->avctx->hwaccel && (ret = h->avctx->hwaccel->start_frame(h->avctx, buf, buf_size)) < 0) goto end; -#if FF_API_CAP_VDPAU - if (CONFIG_H264_VDPAU_DECODER && - h->avctx->codec->capabilities & AV_CODEC_CAP_HWACCEL_VDPAU) +#if FF_API_CAP_VDPAU && CONFIG_H264_VDPAU_DECODER + if (h->avctx->codec->capabilities & AV_CODEC_CAP_HWACCEL_VDPAU) ff_vdpau_h264_picture_start(h); #endif } @@ -858,9 +858,8 @@ again: nal->raw_size); if (ret < 0) goto end; -#if FF_API_CAP_VDPAU - } else if (CONFIG_H264_VDPAU_DECODER && - h->avctx->codec->capabilities & AV_CODEC_CAP_HWACCEL_VDPAU) { +#if FF_API_CAP_VDPAU && CONFIG_H264_VDPAU_DECODER + } else if (h->avctx->codec->capabilities & AV_CODEC_CAP_HWACCEL_VDPAU) { ff_vdpau_add_data_chunk(h->cur_pic_ptr->f->data[0], start_code, sizeof(start_code)); diff --git a/libavcodec/mpeg12dec.c b/libavcodec/mpeg12dec.c index 204a578..f779a3d 100644 --- a/libavcodec/mpeg12dec.c +++ b/libavcodec/mpeg12dec.c @@ -2433,9 +2433,8 @@ static int decode_chunks(AVCodecContext *avctx, AVFrame *picture, s2->er.error_count += s2->thread_context[i]->er.error_count; } -#if FF_API_VDPAU - if ((CONFIG_MPEG_VDPAU_DECODER || CONFIG_MPEG1_VDPAU_DECODER) - && uses_vdpau(avctx)) +#if FF_API_VDPAU && (CONFIG_MPEG_VDPAU_DECODER || CONFIG_MPEG1_VDPAU_DECODER) + if (uses_vdpau(avctx)) ff_vdpau_mpeg_picture_complete(s2, buf, buf_size, s->slice_count); #endif diff --git a/libavcodec/vc1dec.c b/libavcodec/vc1dec.c index 4f78aa8..34ed799 100644 --- a/libavcodec/vc1dec.c +++ b/libavcodec/vc1dec.c @@ -909,9 +909,8 @@ static int vc1_decode_frame(AVCodecContext *avctx, void *data, s->me.qpel_put = s->qdsp.put_qpel_pixels_tab; s->me.qpel_avg = s->qdsp.avg_qpel_pixels_tab; -#if FF_API_CAP_VDPAU - if ((CONFIG_VC1_VDPAU_DECODER) - &&s->avctx->codec->capabilities&AV_CODEC_CAP_HWACCEL_VDPAU) { +#if FF_API_CAP_VDPAU && CONFIG_VC1_VDPAU_DECODER + if (s->avctx->codec->capabilities&AV_CODEC_CAP_HWACCEL_VDPAU) { if (v->field_mode && buf_start_second_field) { ff_vdpau_vc1_decode_picture(s, buf_start, buf_start_second_field - buf_start); ff_vdpau_vc1_decode_picture(s, buf_start_second_field, (buf + buf_size) - buf_start_second_field); diff --git a/libavcodec/vdpau_compat.h b/libavcodec/vdpau_compat.h index 768acce..080381e 100644 --- a/libavcodec/vdpau_compat.h +++ b/libavcodec/vdpau_compat.h @@ -25,7 +25,9 @@ #define AVCODEC_VDPAU_COMPAT_H #include +#include "config.h" +#if CONFIG_VDPAU #include "h264dec.h" #include "mpeg4video.h" @@ -44,5 +46,6 @@ void ff_vdpau_vc1_decode_picture(MpegEncContext *s, const uint8_t *buf, void ff_vdpau_mpeg4_decode_picture(Mpeg4DecContext *s, const uint8_t *buf, int buf_size); +#endif #endif /* AVCODEC_VDPAU_COMPAT_H */ -- 2.9.1