From patchwork Thu Aug 3 13:58:22 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: francesco@bltitalia.com X-Patchwork-Id: 4614 Delivered-To: ffmpegpatchwork@gmail.com Received: by 10.103.46.211 with SMTP id u202csp929891vsu; Thu, 3 Aug 2017 06:58:34 -0700 (PDT) X-Received: by 10.223.165.129 with SMTP id g1mr1323525wrc.167.1501768714394; Thu, 03 Aug 2017 06:58:34 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1501768714; cv=none; d=google.com; s=arc-20160816; b=K0+Ge3YOt3ZFJJShlWeZYFnMVlSlgjndPdlXC9NpxV+XiMjfPJpQ81O5BoSucxBvJy MzAMuKcnbv7Y4GdGrRh4/7NRSeePNQicGuQYtuHyQjoq8sV21ouwIIEAtq1Jmyo0/xbA QdaVx96sPzfsHiszmcVMkglOQYKbiQG+tvxdcdQuqDDaMb4K87mo61WYqxXb7AxO02zy VobuGTolaRonyR2s5oFI0JSdb9MBQVUvv739/6wt1HCTyB17Q6agFZwjKoNu53RWN/zz x2Y7KQ7P1izb1kAID4Hqa9CSdupFoUZghGFMKCuGWX8sCh66dvqRQuimSEswsx+Y2bas 8v0A== 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:cc:reply-to :list-subscribe:list-help:list-post:list-archive:list-unsubscribe :list-id:precedence:subject:dkim-signature:message-id:date:to:from :delivered-to:arc-authentication-results; bh=aJSPK6lA4C5DjZaO7ALt+qsltmdOof+equTkstcbgog=; b=pZLMDCcfXGLNGhL3mywctjOAF2KoQTrGAyDszndj0Z/yyoS4voldLlM3aBpd96Fntb O0UhW2U/z5LrsThwcDDouzrrinR4/zBka4lJNN12zOoq4BTXa5QGlG2l/i4BmWQJvne5 Rpzgc7BdK7m9Z0izFmCaI+3l7jV3Kyd/U+dzLM9b4ZDIaiR/zzjtXb5skU/Pl8Gn8y23 tRetgiKGGhZyoQvuMfQgiOobotinM2ucTWsUpyQDu2cxboIyee4dweHy6fLcYE/WoHHt FyqTnfw3xqb6bSXdybtjSL8gUb+evBvIcYdW4pi4z2uEbrFUHHE4Pezbwq/c3JdGEpJv 4izw== ARC-Authentication-Results: i=1; mx.google.com; dkim=neutral (body hash did not verify) header.i=@aruba.it header.s=a1 header.b=lPF1Bo3A; 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 i74si1388631wmh.184.2017.08.03.06.58.33; Thu, 03 Aug 2017 06:58:34 -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=@aruba.it header.s=a1 header.b=lPF1Bo3A; 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 1F9BA6882A7; Thu, 3 Aug 2017 16:58:27 +0300 (EEST) X-Original-To: ffmpeg-devel@ffmpeg.org Delivered-To: ffmpeg-devel@ffmpeg.org Received: from smtpcmd10101.aruba.it (smtpcmd14161.aruba.it [62.149.156.161]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTP id 6EEC9680AD6 for ; Thu, 3 Aug 2017 16:58:20 +0300 (EEST) Received: from debiandevelop.rosselli.domain ([79.27.203.181]) by smtpcmd14.ad.aruba.it with bizsmtp id sdyN1v01l3vLJav01dyPCZ; Thu, 03 Aug 2017 15:58:23 +0200 From: francesco@bltitalia.com To: ffmpeg-devel@ffmpeg.org Date: Thu, 3 Aug 2017 15:58:22 +0200 Message-Id: <1501768702-24637-1-git-send-email-francesco@bltitalia.com> X-Mailer: git-send-email 2.1.4 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=aruba.it; s=a1; t=1501768703; bh=+cw3vVbasDw1GUAgPW9KuxGl73bWaC/bMlcgKJsf82o=; h=From:To:Subject:Date; b=lPF1Bo3AKP1LMxlltFdW0RaxMvRUhDyhP/kyTTF/OapClcNhlwLkXQiI9paKzQEGj wZcJip9wSWkG5kiu/Bp9bQMjzAD35sTrUwZZ0taia1S7lCPjNMLr0ndj4yxrTy5zyn J+H78Oh/3Bo/dqBT/SE/38UL097yzJX6hTvcazp02tA/A0fTibAv5MwCybWR1YLEE2 Ip+N8CuUiwxrge4UKHTVR0an/hjVLubYDU05wvwdnPS2njqtU7kw2xLYKs3Ly2IC95 csRjcLmPkjTbHX2obzcoVNQuigJdsYW4IpnP1HdFpOTWvFgr4CUs1HSUDF5NQZE0Jh 2Z+zzVwh+SaMQ== Subject: [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 MIME-Version: 1.0 Errors-To: ffmpeg-devel-bounces@ffmpeg.org Sender: "ffmpeg-devel" 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. --- libavcodec/j2kenc.c | 22 +++++++++++++--------- 1 file changed, 13 insertions(+), 9 deletions(-) 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, "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 } };