From patchwork Sat May 6 09:20:04 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Nicolas George X-Patchwork-Id: 3592 Delivered-To: ffmpegpatchwork@gmail.com Received: by 10.103.3.129 with SMTP id 123csp34607vsd; Sat, 6 May 2017 02:20:19 -0700 (PDT) X-Received: by 10.28.169.198 with SMTP id s189mr7418271wme.91.1494062419076; Sat, 06 May 2017 02:20:19 -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 w43si9127048wrb.207.2017.05.06.02.20.17; Sat, 06 May 2017 02:20:19 -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 D9772689A3B; Sat, 6 May 2017 12:20:09 +0300 (EEST) X-Original-To: ffmpeg-devel@ffmpeg.org Delivered-To: ffmpeg-devel@ffmpeg.org Received: from nef2.ens.fr (nef2.ens.fr [129.199.96.40]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTP id 9A942680ADB for ; Sat, 6 May 2017 12:20:03 +0300 (EEST) Received: from phare.normalesup.org (archicubes.ens.fr [129.199.129.80]) by nef2.ens.fr (8.13.6/1.01.28121999) with ESMTP id v469K8RU023324 for ; Sat, 6 May 2017 11:20:08 +0200 (CEST) Received: by phare.normalesup.org (Postfix, from userid 1001) id 6F24CE0095; Sat, 6 May 2017 11:20:08 +0200 (CEST) From: Nicolas George To: ffmpeg-devel@ffmpeg.org Date: Sat, 6 May 2017 11:20:04 +0200 Message-Id: <20170506092006.22397-1-george@nsup.org> X-Mailer: git-send-email 2.11.0 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.4.3 (nef2.ens.fr [129.199.96.32]); Sat, 06 May 2017 11:20:08 +0200 (CEST) Subject: [FFmpeg-devel] [PATCH 1/3] lavu/frame: add av_frame_realign(). 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 MIME-Version: 1.0 Errors-To: ffmpeg-devel-bounces@ffmpeg.org Sender: "ffmpeg-devel" TODO Actual implementation. Signed-off-by: Nicolas George --- libavutil/frame.h | 9 +++++++++ 1 file changed, 9 insertions(+) Here is a proposal for actually fixing the alignment problems that are all over the place in the current code base. Note that it is only a design proposal, all the actual implementation is missing. I do not want to waste my time implementing if the design is to be bikeshedded to death. diff --git a/libavutil/frame.h b/libavutil/frame.h index 4d8c1bed4f..162ea0716c 100644 --- a/libavutil/frame.h +++ b/libavutil/frame.h @@ -746,6 +746,15 @@ void av_frame_remove_side_data(AVFrame *frame, enum AVFrameSideDataType type); const char *av_frame_side_data_name(enum AVFrameSideDataType type); /** + * Realign the data pointers of a frame. + * Make sure all frame data pointers have the alignment lower bits cleared, + * i.e. are a multiple of 1<=0 for success or an AVERROR code. + */ +int av_frame_realign(AVFrame *frame, unsigned align); + +/** * @} */