From patchwork Thu Aug 3 17:24:33 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Aaron Boxer X-Patchwork-Id: 4617 Delivered-To: ffmpegpatchwork@gmail.com Received: by 10.103.46.211 with SMTP id u202csp1164275vsu; Thu, 3 Aug 2017 10:24:46 -0700 (PDT) X-Received: by 10.28.169.70 with SMTP id s67mr8109wme.47.1501781086471; Thu, 03 Aug 2017 10:24:46 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1501781086; cv=none; d=google.com; s=arc-20160816; b=xUhT6IL9uzI26NtsTIabiBF+4L+G2eiI+fP0db0jaNFc3rSlZtqZKf9lYjG03Bcd75 JPccAzp9JC+t8EiEj+O1OmtNeOCLQdELpxp0ITF30bhyB8Rh5iBhfu/bRz+d6IXNfdDk nrQtN4amJglURmVMpTw2AsjR6VR9A15WyUH2/l2DJ4UbhYyxWr3fsvSechTjGUmpWfCC zIi+tmgMkPBxWC2LxSyRE3Zo/jRBxbnxHUO9bxEI0AM78GDjIGkC/48XNP1RWuqTiy4j uzn3ouYNHvYeE5+5y52sqUNT1CViu0MszwraYT8cRpkOzah5cTFloC/JNugzLtOwi9Ke CYbg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:content-transfer-encoding:cc:reply-to :list-subscribe:list-help:list-post:list-archive:list-unsubscribe :list-id:precedence:subject:to:message-id:date:from:references :in-reply-to:mime-version:dkim-signature:delivered-to :arc-authentication-results; bh=kvrObVGfLnQ1BmpVK4hTfvUry4YKLwuvX4NwGV2vl6w=; b=wq3EYhwZ6t/RcUXmHaydPO9OP0XXTLSK1vC4RuaGQb0QkzIYCNQHHcY+1ggozcdokD Jm89Boq+nrVvGR7DDiNiH0rG2oJ48WXU0kN9KE//ysnrqAWzLRP0v0nwllfMbyu/Qn/U +qjzrKza7pIO+PPe3X5cfc1D7jIncDvTMmzlJdoUMnzIkzY+u6QA6MRzZ14PvpQulUUu CdwLxi/tO040Vxav4cb0qFf//a2jXOYuxLRXudsqldRmgO3u1JmqCUjeMcFmIwYgwIWn gElzfFsWNh4qdJCbwquGOFQ426KdPG1ymyW7POdouKoy0GB3vBb7+MJONlBonrwq/bmJ O8JQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=neutral (body hash did not verify) header.i=@gmail.com header.b=TtbSaTR1; 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 sp=NONE dis=NONE) header.from=gmail.com Return-Path: Received: from ffbox0-bg.mplayerhq.hu (ffbox0-bg.ffmpeg.org. [79.124.17.100]) by mx.google.com with ESMTP id j2si1888021wrj.325.2017.08.03.10.24.44; Thu, 03 Aug 2017 10:24:46 -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 header.b=TtbSaTR1; 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 sp=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 64A3C6882C5; Thu, 3 Aug 2017 20:24:38 +0300 (EEST) X-Original-To: ffmpeg-devel@ffmpeg.org Delivered-To: ffmpeg-devel@ffmpeg.org Received: from mail-qt0-f171.google.com (mail-qt0-f171.google.com [209.85.216.171]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id AB1626807B8 for ; Thu, 3 Aug 2017 20:24:31 +0300 (EEST) Received: by mail-qt0-f171.google.com with SMTP id v29so11599836qtv.3 for ; Thu, 03 Aug 2017 10:24:35 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:in-reply-to:references:from:date:message-id:subject:to :cc; bh=z4gAyn1Ui7FdJYoC/oZPuolEtksK9Lzy5BgjaEfOkoY=; b=TtbSaTR1M4Hd4RkKHKhWXqb5et2rU000IqiKbdnvsPV6JNNnG4fak4ia7gzjr5A/EP z90VNm85+4hW23EUJ0yg73pmXpsMo+nWUyRIrS1Gk22Ch/4U9wZUwLed4pq9p5wkXuqR FppOuTBjyqY/36uO7h2lwyqLdUuQXHjkHdMFNvBZQ0VhrS8LTmHsyeZnjP811CUA3HUB nJE2xAZMm6Gzh28AGk1WvZPlhJQ+6PmyQcqgze7tgQuAfI8494LtDkyOeBokJwQHACLL oRVfZ+vDL+ALX8qXndPpb9btDAJmsqBDJRQYIYmGwcmC+UkkbKXL57WRoQe9+iGLT3sK Ypqg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:in-reply-to:references:from:date :message-id:subject:to:cc; bh=z4gAyn1Ui7FdJYoC/oZPuolEtksK9Lzy5BgjaEfOkoY=; b=lCX3Ol6AwK9W2vwk3GI12dMGTEuTVfHwLgGbvDIP+ZiebuGzCmqmMexgK37A83jojd fUmJK95kihyHTBBDYHP4zIv6VX7wd1D8yaJRBFRZecPN/LhTUKa9UAylpCYbw7hViSWY mS1f8+Nl+dZuYqljkFSnQv4J5N6u2xgOASNAYAp1pJiwjMUTy1tXZYjgzKGZGAtWp0st Lo8H2IUzQd1Bnxp/vAWAPGCfE5LXx82x1vBFonxd3/xhnI+/svbI8u0AOrct+r0Iy3mi IYpdhydkV1zSuR3kg0yqSmVVGedOhzOg8F6sKqlT0Zpn041IyWnE7PQuLp7AgzESEfFX J82w== X-Gm-Message-State: AHYfb5gSSkKS/KAE/WlqwsXyK/KzzlJby1X/SGf9498J1j5VnZLCukXn 88qu8l+OkW1Sg8wUFIBviJ8D7Jpk7Q== X-Received: by 10.237.34.185 with SMTP id p54mr3151507qtc.250.1501781073979; Thu, 03 Aug 2017 10:24:33 -0700 (PDT) MIME-Version: 1.0 Received: by 10.140.30.162 with HTTP; Thu, 3 Aug 2017 10:24:33 -0700 (PDT) Received: by 10.140.30.162 with HTTP; Thu, 3 Aug 2017 10:24:33 -0700 (PDT) In-Reply-To: <1501768702-24637-1-git-send-email-francesco@bltitalia.com> References: <1501768702-24637-1-git-send-email-francesco@bltitalia.com> From: Aaron Boxer Date: Thu, 3 Aug 2017 13:24:33 -0400 Message-ID: To: FFmpeg development discussions and patches X-Content-Filtered-By: Mailman/MimeDel 2.1.20 Subject: Re: [FFmpeg-devel] [PATCH] JPEG2000 encoding with variable codeblock size 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 Cc: Francesco Cuzzocrea Errors-To: ffmpeg-devel-bounces@ffmpeg.org Sender: "ffmpeg-devel" On Aug 3, 2017 9:58 AM, wrote: From: Francesco Cuzzocrea Hi to all I've made some simple changes tha allow encoding with variable codeblock size. Default value are the same as previous (16X16) but now setting them to 64x128 make generated codestream compatible with Analog Devices ADV212 video codec. Interesting - as far as I aware, part 1 of standard only allows codeblock of max size 4096, so 64x128 would not be legal. --- libavcodec/j2kenc.c | 22 +++++++++++++--------- 1 file changed, 13 insertions(+), 9 deletions(-) "pred" }, - + { "format", "Codec Format", OFFSET(format), AV_OPT_TYPE_INT, { .i64 = CODEC_JP2 }, CODEC_J2K, CODEC_JP2, VE, "format" }, + { "j2k", NULL, 0, AV_OPT_TYPE_CONST, { .i64 = CODEC_J2K }, 0, 0, VE, "format" }, + { "jp2", NULL, 0, AV_OPT_TYPE_CONST, { .i64 = CODEC_JP2 }, 0, 0, VE, "format" }, + { "tile_width", "Tile Width", OFFSET(tile_width), AV_OPT_TYPE_INT, { .i64 = 256 }, 1, 1<<30, VE, }, + { "tile_height", "Tile Height", OFFSET(tile_height), AV_OPT_TYPE_INT, { .i64 = 256 }, 1, 1<<30, VE, }, + { "pred", "DWT Type", OFFSET(pred), AV_OPT_TYPE_INT, { .i64 = 0 }, 0, 1, VE, "pred" }, + { "dwt97int", NULL, 0, AV_OPT_TYPE_CONST, { .i64 = 0 }, INT_MIN, INT_MAX, VE, "pred" }, + { "dwt53", NULL, 0, AV_OPT_TYPE_CONST, { .i64 = 0 }, INT_MIN, INT_MAX, VE, "pred" }, + { "log2_cblk_width", "Codeblock Width", (OFFSET(codsty)+OFFSET1(log2_cblk_width)), AV_OPT_TYPE_INT, { .i64 = 4 }, 1, 1<<30, VE, }, + { "log2_cblk_height", "Codeblock Height", (OFFSET(codsty)+OFFSET1(log2_cblk_height)), AV_OPT_TYPE_INT, { .i64 = 4 }, 1, 1<<30, VE, }, { NULL } }; -- 2.1.4 diff --git a/libavcodec/j2kenc.c b/libavcodec/j2kenc.c index c8d3861..1bd4fbd 100644 --- a/libavcodec/j2kenc.c +++ b/libavcodec/j2kenc.c @@ -1178,17 +1178,21 @@ static int j2kenc_destroy(AVCodecContext *avctx) // taken from the libopenjpeg wraper so it matches #define OFFSET(x) offsetof(Jpeg2000EncoderContext, x) +#define OFFSET1(x) offsetof(Jpeg2000CodingStyle, x) + + #define VE AV_OPT_FLAG_VIDEO_PARAM | AV_OPT_FLAG_ENCODING_PARAM static const AVOption options[] = { - { "format", "Codec Format", OFFSET(format), AV_OPT_TYPE_INT, { .i64 = CODEC_JP2 }, CODEC_J2K, CODEC_JP2, VE, "format" }, - { "j2k", NULL, 0, AV_OPT_TYPE_CONST, { .i64 = CODEC_J2K }, 0, 0, VE, "format" }, - { "jp2", NULL, 0, AV_OPT_TYPE_CONST, { .i64 = CODEC_JP2 }, 0, 0, VE, "format" }, - { "tile_width", "Tile Width", OFFSET(tile_width), AV_OPT_TYPE_INT, { .i64 = 256 }, 1, 1<<30, VE, }, - { "tile_height", "Tile Height", OFFSET(tile_height), AV_OPT_TYPE_INT, { .i64 = 256 }, 1, 1<<30, VE, }, - { "pred", "DWT Type", OFFSET(pred), AV_OPT_TYPE_INT, { .i64 = 0 }, 0, 1, VE, "pred" }, - { "dwt97int", NULL, 0, AV_OPT_TYPE_CONST, { .i64 = 0 }, INT_MIN, INT_MAX, VE, "pred" }, - { "dwt53", NULL, 0, AV_OPT_TYPE_CONST, { .i64 = 0 }, INT_MIN, INT_MAX, VE,