[FFmpeg-devel] [PATCH 17/25] avcodec/utvideo: Move stuff only used by Ut encoder to Ut encoder

Paul B Mahol onemda at gmail.com
Sat Sep 26 14:02:03 EEST 2020


On Sat, Sep 26, 2020 at 12:27:56PM +0200, Andreas Rheinhardt wrote:
> Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt at gmail.com>
> ---
>  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

lgtm

> 
> 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)
> -- 
> 2.25.1
> 
> _______________________________________________
> ffmpeg-devel mailing list
> ffmpeg-devel at ffmpeg.org
> https://ffmpeg.org/mailman/listinfo/ffmpeg-devel
> 
> To unsubscribe, visit link above, or email
> ffmpeg-devel-request at ffmpeg.org with subject "unsubscribe".


More information about the ffmpeg-devel mailing list