From patchwork Mon Jul 27 16:32:19 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mark Thompson X-Patchwork-Id: 21294 Return-Path: X-Original-To: patchwork@ffaux-bg.ffmpeg.org Delivered-To: patchwork@ffaux-bg.ffmpeg.org Received: from ffbox0-bg.mplayerhq.hu (ffbox0-bg.ffmpeg.org [79.124.17.100]) by ffaux.localdomain (Postfix) with ESMTP id 237B644B627 for ; Mon, 27 Jul 2020 19:32:57 +0300 (EEST) Received: from [127.0.1.1] (localhost [127.0.0.1]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTP id F22E068B8F8; Mon, 27 Jul 2020 19:32:56 +0300 (EEST) X-Original-To: ffmpeg-devel@ffmpeg.org Delivered-To: ffmpeg-devel@ffmpeg.org Received: from mail-wr1-f54.google.com (mail-wr1-f54.google.com [209.85.221.54]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id E893068B861 for ; Mon, 27 Jul 2020 19:32:47 +0300 (EEST) Received: by mail-wr1-f54.google.com with SMTP id a5so5553954wrm.6 for ; Mon, 27 Jul 2020 09:32:47 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=jkqxz-net.20150623.gappssmtp.com; s=20150623; h=from:to:subject:date:message-id:in-reply-to:references:mime-version :content-transfer-encoding; bh=aW2MuC9bq9z7C0Tb4vwqgdvFoT6YoNfsCoXPK6fsugc=; b=HhNPrM2oUS8/3EKshyHtXWk5+NHresJZYX3MnaEm0aRZMWy587NlVn8zqkbP96Awhz Ii0GGzFv8jB3fhvDOZkAmAp2irN/12qFg/xhbP1FN/G+QG5uQCD8r8+bD7f70Oe2i+Ik VmmMA+80L94sZr9jEOoGBKg0LVG3Ki4dyA7TAbAMNCtmmOgZcnQLB8tAlOvkf49z7+le RFYBMaLxDzJWyic6Xnr5QYFi1/bmg2Dk49+LDUWSIGJWppl6J5WPZI0xTqrNcN9uZXlv PCatMnfC+hZBbyIhJuLHjeswIB4oyX5vPQTnqZm0KMnN62EPfHokFuTNLlPN0SbRgBDu 4MHQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=aW2MuC9bq9z7C0Tb4vwqgdvFoT6YoNfsCoXPK6fsugc=; b=VYdzHYx0TRF/cNsfiQommOLCxvIOPzSLifR0AyIuOPCjSGa/+1AfWhjRN0B18SA+/k xuCkMxz7kMVAkkeNlcW3d7nJ0kMnH8yAC0SYdS0NbaAKG/K24CxIA7+mGd/l3yuj35gJ cvvlU9ezEAByZr54s2R8u7+gsSKUY+ICvzX08KEtGThRT4PI7LNFZ6c+ikQSYR7NFJvJ 7wWOEc+/ukmIU6Hkq1AJIG9iOXvq9NQsFTRTczSkWUOMfH5tUlQEz0azVHiWfOhCh2Sz sSzeJQMPdSWbL3FXGk8Tnhj4+4uLYUu2qqsH3ULHsbaQvc7dlMqXl4h4q+kLibphdB8W Rnzg== X-Gm-Message-State: AOAM533gguJ4eaS5hqxEImcUH5AkpgeTyz8JWvTExdknu3is73h2Qx3S e/DKYnavzPwlHsRbyqFI4d6wYcTE6nA= X-Google-Smtp-Source: ABdhPJxkCDieEyuKN42xFzohaceOi6Z0fLk93/2tSCcCrocUgRfIr4YhVM2tkimoUpLdJHAwffc8ow== X-Received: by 2002:adf:8486:: with SMTP id 6mr21247702wrg.109.1595867567092; Mon, 27 Jul 2020 09:32:47 -0700 (PDT) Received: from rywe.jkqxz.net (cpc91242-cmbg18-2-0-cust650.5-4.cable.virginm.net. [82.8.130.139]) by smtp.gmail.com with ESMTPSA id w16sm14706791wrg.95.2020.07.27.09.32.45 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 27 Jul 2020 09:32:46 -0700 (PDT) From: Mark Thompson To: ffmpeg-devel@ffmpeg.org Date: Mon, 27 Jul 2020 17:32:19 +0100 Message-Id: <20200727163237.23371-5-sw@jkqxz.net> X-Mailer: git-send-email 2.27.0 In-Reply-To: <20200727163237.23371-1-sw@jkqxz.net> References: <20200727163237.23371-1-sw@jkqxz.net> MIME-Version: 1.0 Subject: [FFmpeg-devel] [PATCH v6 04/22] cbs: Add macros to support defining unit type tables 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" --- libavcodec/cbs_internal.h | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) diff --git a/libavcodec/cbs_internal.h b/libavcodec/cbs_internal.h index 282492bc88..35159f9c5f 100644 --- a/libavcodec/cbs_internal.h +++ b/libavcodec/cbs_internal.h @@ -167,6 +167,30 @@ int ff_cbs_write_signed(CodedBitstreamContext *ctx, PutBitContext *pbc, #define MIN_INT_BITS(length) (-(INT64_C(1) << ((length) - 1))) +#define CBS_UNIT_TYPE_POD(type, structure) { \ + .nb_unit_types = 1, \ + .unit_types = { type }, \ + .content_type = CBS_CONTENT_TYPE_POD, \ + .content_size = sizeof(structure), \ + } +#define CBS_UNIT_TYPE_INTERNAL_REF(type, structure, ref_field) { \ + .nb_unit_types = 1, \ + .unit_types = { type }, \ + .content_type = CBS_CONTENT_TYPE_INTERNAL_REFS, \ + .content_size = sizeof(structure), \ + .nb_ref_offsets = 1, \ + .ref_offsets = { offsetof(structure, ref_field) }, \ + } +#define CBS_UNIT_TYPE_COMPLEX(type, structure, free_func) { \ + .nb_unit_types = 1, \ + .unit_types = { type }, \ + .content_type = CBS_CONTENT_TYPE_COMPLEX, \ + .content_size = sizeof(structure), \ + .content_free = free_func, \ + } +#define CBS_UNIT_TYPE_END_OF_LIST { .nb_unit_types = 0 } + + extern const CodedBitstreamType ff_cbs_type_av1; extern const CodedBitstreamType ff_cbs_type_h264; extern const CodedBitstreamType ff_cbs_type_h265;