From patchwork Sun Nov 12 01:29:20 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Michael Niedermayer X-Patchwork-Id: 6003 Delivered-To: ffmpegpatchwork@gmail.com Received: by 10.2.161.94 with SMTP id m30csp635076jah; Sat, 11 Nov 2017 17:29:34 -0800 (PST) X-Google-Smtp-Source: AGs4zMYD0LvXJmFzE+S+OvzGt+f1h+vBmxYZCmJqBmiMjgVGjtUqXfj7a7SyvCYaSARVLmKf4EMl X-Received: by 10.223.186.201 with SMTP id w9mr3700047wrg.230.1510450174140; Sat, 11 Nov 2017 17:29:34 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1510450174; cv=none; d=google.com; s=arc-20160816; b=CwzIvJxqHkF7YzHwdJMrW6CL36sAh7ExCTYT3Zu9D6JK6rwuxy0RXa83NvT7eziSBb cdm4XLFBnmi2zhT8j/sBXRn8FwCllcXqOi7x5aRexlAMokQQOqEwyFIWFuiklWTeGQVF vwfELTjikcUjcADKW9xAWIfENkGPd9jSBra6qBEqFegYdYYUdMmI4nFsT1ysJ/uRa0p7 A34eEH/EcTluWbOQqCUNp9sJLhUmT0nZMsNHTMGwIp3N9kfpBOeJB0PPKtbuMl/wVq+q Pyf1fYU0yX/FBkDVco0MNI7uQLxgQX/195rz3ikHP1eQR5FYn9wMR1rUFSi0+0FdMaBv nMHQ== 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: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=vQT0vjF5X2+lKyfmQ/8cpNzPkiT04GbPGUrY1VS4dWs=; b=aIpTKefOewbrWIgGhDGH5RyHk+EbyRzOTGldHPW1UVObg3k8tnUwTKwLiH7sQ/wRXL f7LbhaPTN4u38Z5Lh3ltvkVUeljXKZlE4dLEredqD/XlhT5HwZYN+yAtF+YOrZUTRh26 f9IkP5abb7d4+cRdtC1rYSE3rw1zfL5jqdT0pk8DEk4WhkyWZJvHN8Ga7LNiReOUj2vZ lR9aSDkUf+Y8kU8pH/dkXteXn9Isu84ZQHU/GiwV26oqhgyGK1S5T2gBK5J49EZFZJPk ZxqHkpE8ZGl6pRkCpX0qXYfGiuzq8hmINA8ZUVSpDCOqlu0me00aDRb25U+BKG+Bdb7T HvtQ== 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 p2si10463034wrb.208.2017.11.11.17.29.33; Sat, 11 Nov 2017 17:29:34 -0800 (PST) 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 D249268A257; Sun, 12 Nov 2017 03:29:18 +0200 (EET) X-Original-To: ffmpeg-devel@ffmpeg.org Delivered-To: ffmpeg-devel@ffmpeg.org Received: from vie01a-dmta-pe08-3.mx.upcmail.net (vie01a-dmta-pe08-3.mx.upcmail.net [84.116.36.22]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id 9F1E168A1D2 for ; Sun, 12 Nov 2017 03:29:12 +0200 (EET) Received: from [172.31.216.43] (helo=vie01a-pemc-psmtp-pe01) by vie01a-dmta-pe08.mx.upcmail.net with esmtp (Exim 4.88) (envelope-from ) id 1eDh5S-0003qu-C2 for ffmpeg-devel@ffmpeg.org; Sun, 12 Nov 2017 02:29:26 +0100 Received: from localhost ([213.47.41.20]) by vie01a-pemc-psmtp-pe01 with SMTP @ mailcloud.upcmail.net id YpVM1w00J0S5wYM01pVNus; Sun, 12 Nov 2017 02:29:22 +0100 X-SourceIP: 213.47.41.20 From: Michael Niedermayer To: FFmpeg development discussions and patches Date: Sun, 12 Nov 2017 02:29:20 +0100 Message-Id: <20171112012920.26183-1-michael@niedermayer.cc> X-Mailer: git-send-email 2.15.0 Subject: [FFmpeg-devel] [PATCH] avutil: add API for mb types. 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" This is based on motion_type.h Signed-off-by: Michael Niedermayer --- libavutil/block_type.h | 107 +++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 107 insertions(+) create mode 100644 libavutil/block_type.h diff --git a/libavutil/block_type.h b/libavutil/block_type.h new file mode 100644 index 0000000000..3f53f1d082 --- /dev/null +++ b/libavutil/block_type.h @@ -0,0 +1,107 @@ +/* + * This file is part of FFmpeg. + * + * FFmpeg is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * FFmpeg is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with FFmpeg; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + */ + +#ifndef AVUTIL_BLOCK_TYPE_H +#define AVUTIL_BLOCK_TYPE_H + +#include + + +typedef struct AVBlockType { + /** + * Block type. + * 1: Prediction (this can be spatial prediction or motion compensation for example) + * 2: Transform + * 3: Residual + * 4: Filter + * 5: Metadata + * + * Multiple Filter, Transform and prediction blocks are allowed, for example + * for bidirectional motion compensation. Multiple residuals are allowed, for + * example DC and AC residual. + */ + uint8_t type; + /** + * Bitmask that lists which planes (for example: Y:1,Cb:2,Cr:4,Alpha:8) + * this block applies to. + */ + uint8_t plane_mask; + /** + * The field (top:1, bottom:2) this block applies to. + */ + uint8_t field_mask; + uint8_t name[16]; + /** + * Left Top corner position. This can be outside of the vissible frame. + */ + int32_t x, y; + /** + * Width and height of the block. + */ + uint16_t w, h; + /** + * Number identifying the slice the Block is in. + */ + uint16_t slice_num; + /** + * Location in bits where the block related information is stored. can be -1 + */ + uint32_t block_index, block_bits; + + /** + * Main Direction, 0 is horizontal, 48 is vertical, + * values 0 to 95 follow clockwise direction. + * 255 means that the block has no direction. + * This represents the main direction of a transform, prediction or filter + */ + uint8_t direction; + + /** + * Quantization parameter, a value of 0x8000 means lossless, 0x7FFF means not applicable + * for MC prediction this is the precission of the motion vector. + */ + int16_t qp; + + /** + * Where the prediction comes from; negative value when it comes + * from the past, positive value when it comes from the future. + * 0 For Intra. + */ + int32_t source; + /** + * Motion vector + * src_x = dst_x + motion_x / qp + * src_y = dst_y + motion_y / qp + */ + int32_t motion_x, motion_y; + + /** + * Extra flag information. + */ + uint64_t flags; +#define AV_BLOCK_TYPE_FLAG_INTERLACED 0x0000001 ///< Block is interlaced + +#define AV_BLOCK_TYPE_FLAG_LEAF 0x0001000 ///< Block is a leaf block, it is not further split +#define AV_BLOCK_TYPE_FLAG_ROOT 0x0002000 ///< Block is a root block, it is not contained in a larger block + +#define AV_BLOCK_TYPE_FLAG_CONCEALED 0x0010000 ///< Block has been replaced by error conclealment +#define AV_BLOCK_TYPE_FLAG_DAMAGED 0x0020000 ///< Block has been damaged + +} AVBlockType; + +#endif /* AVUTIL_BLOCK_TYPE_H */