From patchwork Sat Sep 26 10:27:56 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andreas Rheinhardt X-Patchwork-Id: 22610 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 D713A44A10F for ; Sat, 26 Sep 2020 13:30:15 +0300 (EEST) Received: from [127.0.1.1] (localhost [127.0.0.1]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTP id C4BC368B790; Sat, 26 Sep 2020 13:30:15 +0300 (EEST) X-Original-To: ffmpeg-devel@ffmpeg.org Delivered-To: ffmpeg-devel@ffmpeg.org Received: from mail-wm1-f68.google.com (mail-wm1-f68.google.com [209.85.128.68]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id 11FAC68B73E for ; Sat, 26 Sep 2020 13:30:12 +0300 (EEST) Received: by mail-wm1-f68.google.com with SMTP id y15so1891105wmi.0 for ; Sat, 26 Sep 2020 03:30:12 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=h2zqsiK0iAUCr5aQcZrZ16/QULZ1nfQ2jPaUUsli8XM=; b=mwpEsl4waRJq23VmFI4FiXDNBeAW8vu5a9QLcgmVh0b/PRtxK/5unQxKphTm7k75ic yjVBUt0PXVI2T++01TUECtMmPHK4/2zvNAjFBlU/ccA983uFZGu21WBw3Qq8HzaFjGEF fUojUgE1MedYuZ0y3uI87c4MSPUfEBetF6bHwe9kCXu5EWd0KJIJxEeFFH/BD+xDi14/ FRlFaNOzJVjw24veY4LNM9b8Nu4KgQ5MYgSU1UnjMfu98p2j4XIlz3oL2GH2/G+S8L9G dHcSCNs+DK3GWVc2TnYSMIdPEfqXwYVGjtEoM0h947h5B4ZVDvaN8W0T0IqtJuhY6ZEZ x89Q== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=h2zqsiK0iAUCr5aQcZrZ16/QULZ1nfQ2jPaUUsli8XM=; b=cCAVdbzrvPRKLwIWQut6ex1iqN3ww8UleExx26CSQMf+xhwtBOzNoYxoA4DTVs3yI5 2iBoY/O76vkcQIGODpnWglvUfjmoVxe80+1QdFP+10WrYrNXBjH94D+D7/ObC9zEFE7I GWDv5nKe78q+QGNhzn/loLRJL3wkVjUymQN/iciiq/7mfkVInl5SwRUz/Lu5tZM1W4Ep 4PLO2iwzv758oPupuK349WLGMujNDe+nNFwdFRBYrSG78dSvVDKPt36GK5A/ooFPWAgE 558N4cCdIObB6ekNxdZ3LCCqd5VtiTD2mjH0sG02Y80Ty4UfQO/HpXm/5rZ6UtFDH+yD r2yg== X-Gm-Message-State: AOAM5305vRot91ZhukdJYNWgdvOZeWkkzLYv1nsSRdXYwbwgRkXLAGUm r3bQDDSS3mwdU68PAngwUCillZFBOlE= X-Google-Smtp-Source: ABdhPJxUb/19Z3lnkHrm9y1tfshA8Txx5kcj8puKbOPsdfJWr2ctqMIri7Yhmh8acV9PwEPEWQNL5Q== X-Received: by 2002:a1c:62c2:: with SMTP id w185mr1994317wmb.109.1601116210962; Sat, 26 Sep 2020 03:30:10 -0700 (PDT) Received: from sblaptop.fritz.box (ipbcc1aa4b.dynamic.kabel-deutschland.de. [188.193.170.75]) by smtp.gmail.com with ESMTPSA id k8sm6064867wrl.42.2020.09.26.03.30.09 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 26 Sep 2020 03:30:10 -0700 (PDT) From: Andreas Rheinhardt To: ffmpeg-devel@ffmpeg.org Date: Sat, 26 Sep 2020 12:27:56 +0200 Message-Id: <20200926102804.228089-17-andreas.rheinhardt@gmail.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20200926102804.228089-1-andreas.rheinhardt@gmail.com> References: <20200926102804.228089-1-andreas.rheinhardt@gmail.com> MIME-Version: 1.0 Subject: [FFmpeg-devel] [PATCH 17/25] avcodec/utvideo: Move stuff only used by Ut encoder to Ut encoder 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: Andreas Rheinhardt Errors-To: ffmpeg-devel-bounces@ffmpeg.org Sender: "ffmpeg-devel" Signed-off-by: Andreas Rheinhardt --- libavcodec/Makefile | 4 ++-- libavcodec/utvideo.c | 39 --------------------------------------- libavcodec/utvideo.h | 12 ------------ libavcodec/utvideoenc.c | 23 +++++++++++++++++++++-- 4 files changed, 23 insertions(+), 55 deletions(-) delete mode 100644 libavcodec/utvideo.c diff --git a/libavcodec/Makefile b/libavcodec/Makefile index 9b120a6f64..bee2335a5a 100644 --- a/libavcodec/Makefile +++ b/libavcodec/Makefile @@ -664,8 +664,8 @@ OBJS-$(CONFIG_TTA_ENCODER) += ttaenc.o ttaencdsp.o ttadata.o OBJS-$(CONFIG_TWINVQ_DECODER) += twinvqdec.o twinvq.o OBJS-$(CONFIG_TXD_DECODER) += txd.o OBJS-$(CONFIG_ULTI_DECODER) += ulti.o -OBJS-$(CONFIG_UTVIDEO_DECODER) += utvideodec.o utvideo.o utvideodsp.o -OBJS-$(CONFIG_UTVIDEO_ENCODER) += utvideoenc.o utvideo.o +OBJS-$(CONFIG_UTVIDEO_DECODER) += utvideodec.o utvideodsp.o +OBJS-$(CONFIG_UTVIDEO_ENCODER) += utvideoenc.o OBJS-$(CONFIG_V210_DECODER) += v210dec.o OBJS-$(CONFIG_V210_ENCODER) += v210enc.o OBJS-$(CONFIG_V210X_DECODER) += v210x.o diff --git a/libavcodec/utvideo.c b/libavcodec/utvideo.c deleted file mode 100644 index 0cf0cbcd8b..0000000000 --- a/libavcodec/utvideo.c +++ /dev/null @@ -1,39 +0,0 @@ -/* - * Common Ut Video code - * Copyright (c) 2011 Konstantin Shishkov - * - * 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 - */ - -/** - * @file - * Common Ut Video code - */ - -#include "utvideo.h" - -#if FF_API_PRIVATE_OPT -const int ff_ut_pred_order[5] = { - PRED_LEFT, PRED_MEDIAN, PRED_MEDIAN, PRED_NONE, PRED_GRADIENT -}; -#endif - -int ff_ut_huff_cmp_len(const void *a, const void *b) -{ - const HuffEntry *aa = a, *bb = b; - return (aa->len - bb->len)*256 + aa->sym - bb->sym; -} diff --git a/libavcodec/utvideo.h b/libavcodec/utvideo.h index 2975f287a7..9da9329ff3 100644 --- a/libavcodec/utvideo.h +++ b/libavcodec/utvideo.h @@ -61,9 +61,6 @@ enum { UTVIDEO_444 = MKTAG('Y', 'V', '2', '4'), }; -/* Mapping of libavcodec prediction modes to Ut Video's */ -extern const int ff_ut_pred_order[5]; - typedef struct UtvideoContext { const AVClass *class; AVCodecContext *avctx; @@ -91,13 +88,4 @@ typedef struct UtvideoContext { size_t control_stream_size[4][256]; } UtvideoContext; -typedef struct HuffEntry { - uint16_t sym; - uint8_t len; - uint32_t code; -} HuffEntry; - -/* Compare huffman tree nodes */ -int ff_ut_huff_cmp_len(const void *a, const void *b); - #endif /* AVCODEC_UTVIDEO_H */ diff --git a/libavcodec/utvideoenc.c b/libavcodec/utvideoenc.c index 05a9614036..5c87eb50ac 100644 --- a/libavcodec/utvideoenc.c +++ b/libavcodec/utvideoenc.c @@ -37,6 +37,25 @@ #include "utvideo.h" #include "huffman.h" +typedef struct HuffEntry { + uint16_t sym; + uint8_t len; + uint32_t code; +} HuffEntry; + +#if FF_API_PRIVATE_OPT +static const int ut_pred_order[5] = { + PRED_LEFT, PRED_MEDIAN, PRED_MEDIAN, PRED_NONE, PRED_GRADIENT +}; +#endif + +/* Compare huffman tree nodes */ +static int ut_huff_cmp_len(const void *a, const void *b) +{ + const HuffEntry *aa = a, *bb = b; + return (aa->len - bb->len)*256 + aa->sym - bb->sym; +} + /* Compare huffentry symbols */ static int huff_cmp_sym(const void *a, const void *b) { @@ -139,7 +158,7 @@ FF_DISABLE_DEPRECATION_WARNINGS /* Convert from libavcodec prediction type to Ut Video's */ if (avctx->prediction_method) - c->frame_pred = ff_ut_pred_order[avctx->prediction_method]; + c->frame_pred = ut_pred_order[avctx->prediction_method]; FF_ENABLE_DEPRECATION_WARNINGS #endif @@ -340,7 +359,7 @@ static void calculate_codes(HuffEntry *he) int last, i; uint32_t code; - qsort(he, 256, sizeof(*he), ff_ut_huff_cmp_len); + qsort(he, 256, sizeof(*he), ut_huff_cmp_len); last = 255; while (he[last].len == 255 && last)