summaryrefslogtreecommitdiff
path: root/libavcodec/utvideoenc.c
diff options
context:
space:
mode:
authorAndreas Rheinhardt <andreas.rheinhardt@gmail.com>2020-09-24 18:43:11 +0200
committerAndreas Rheinhardt <andreas.rheinhardt@gmail.com>2020-09-26 21:10:45 +0200
commitbb16dbc0026c43d3aba6d803bb0a968ece25ba2b (patch)
tree246ea3660c90bbb755da028535e99bbaf0a087c1 /libavcodec/utvideoenc.c
parent5f5f0b06cf1f4aed336467b826962d7f85b81a1e (diff)
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>
Diffstat (limited to 'libavcodec/utvideoenc.c')
-rw-r--r--libavcodec/utvideoenc.c23
1 files changed, 21 insertions, 2 deletions
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)