1
0
mirror of https://github.com/FFmpeg/FFmpeg.git synced 2024-12-23 12:43:46 +02:00

avcodec/utvideo: Move stuff only used by Ut encoder to Ut encoder

Reviewed-by: Paul B Mahol <onemda@gmail.com>
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
This commit is contained in:
Andreas Rheinhardt 2020-09-24 18:43:11 +02:00
parent 5f5f0b06cf
commit bb16dbc002
4 changed files with 23 additions and 55 deletions

View File

@ -664,8 +664,8 @@ OBJS-$(CONFIG_TTA_ENCODER) += ttaenc.o ttaencdsp.o ttadata.o
OBJS-$(CONFIG_TWINVQ_DECODER) += twinvqdec.o twinvq.o OBJS-$(CONFIG_TWINVQ_DECODER) += twinvqdec.o twinvq.o
OBJS-$(CONFIG_TXD_DECODER) += txd.o OBJS-$(CONFIG_TXD_DECODER) += txd.o
OBJS-$(CONFIG_ULTI_DECODER) += ulti.o OBJS-$(CONFIG_ULTI_DECODER) += ulti.o
OBJS-$(CONFIG_UTVIDEO_DECODER) += utvideodec.o utvideo.o utvideodsp.o OBJS-$(CONFIG_UTVIDEO_DECODER) += utvideodec.o utvideodsp.o
OBJS-$(CONFIG_UTVIDEO_ENCODER) += utvideoenc.o utvideo.o OBJS-$(CONFIG_UTVIDEO_ENCODER) += utvideoenc.o
OBJS-$(CONFIG_V210_DECODER) += v210dec.o OBJS-$(CONFIG_V210_DECODER) += v210dec.o
OBJS-$(CONFIG_V210_ENCODER) += v210enc.o OBJS-$(CONFIG_V210_ENCODER) += v210enc.o
OBJS-$(CONFIG_V210X_DECODER) += v210x.o OBJS-$(CONFIG_V210X_DECODER) += v210x.o

View File

@ -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;
}

View File

@ -61,9 +61,6 @@ enum {
UTVIDEO_444 = MKTAG('Y', 'V', '2', '4'), 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 { typedef struct UtvideoContext {
const AVClass *class; const AVClass *class;
AVCodecContext *avctx; AVCodecContext *avctx;
@ -91,13 +88,4 @@ typedef struct UtvideoContext {
size_t control_stream_size[4][256]; size_t control_stream_size[4][256];
} UtvideoContext; } 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 */ #endif /* AVCODEC_UTVIDEO_H */

View File

@ -37,6 +37,25 @@
#include "utvideo.h" #include "utvideo.h"
#include "huffman.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 */ /* Compare huffentry symbols */
static int huff_cmp_sym(const void *a, const void *b) 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 */ /* Convert from libavcodec prediction type to Ut Video's */
if (avctx->prediction_method) 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 FF_ENABLE_DEPRECATION_WARNINGS
#endif #endif
@ -340,7 +359,7 @@ static void calculate_codes(HuffEntry *he)
int last, i; int last, i;
uint32_t code; uint32_t code;
qsort(he, 256, sizeof(*he), ff_ut_huff_cmp_len); qsort(he, 256, sizeof(*he), ut_huff_cmp_len);
last = 255; last = 255;
while (he[last].len == 255 && last) while (he[last].len == 255 && last)