summaryrefslogtreecommitdiff
path: root/libavcodec/clearvideo.c
diff options
context:
space:
mode:
authorAndreas Rheinhardt <andreas.rheinhardt@gmail.com>2020-11-17 08:46:53 +0100
committerAndreas Rheinhardt <andreas.rheinhardt@gmail.com>2020-12-08 17:51:45 +0100
commitef9652bab2921126a88111cebfbd645050a5e373 (patch)
tree6525bd82130f23992b62704e406bfb1730f1a244 /libavcodec/clearvideo.c
parent1d3ec27bd54ceb5108ad9f9ed430266ccc4cbc71 (diff)
avcodec/clearvideo: Improve handling of VLC escape values
Both the motion vector as well as the bias VLCs have an escape code; for the motion vectors, this value depended on the specific VLC table, whereas all the bias VLCs used the same value; the escape value has not been inlined in the latter case. But for both kinds of VLCs there are lots of values that are unused for all the VLCs of each kind and each of these can be used as common escape value, thus allowing to inline the escape value. This commit implements this. Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
Diffstat (limited to 'libavcodec/clearvideo.c')
-rw-r--r--libavcodec/clearvideo.c8
1 files changed, 2 insertions, 6 deletions
diff --git a/libavcodec/clearvideo.c b/libavcodec/clearvideo.c
index 39e3991053..3e666b98e9 100644
--- a/libavcodec/clearvideo.c
+++ b/libavcodec/clearvideo.c
@@ -33,8 +33,6 @@
#include "clearvideodata.h"
typedef struct LevelCodes {
- uint16_t mv_esc;
- uint16_t bias_esc;
VLC flags_cb;
VLC mv_cb;
VLC bias_cb;
@@ -371,7 +369,7 @@ static TileInfo* decode_tile_info(GetBitContext *gb, LevelCodes *lc, int level)
if (lc[level].mv_cb.table) {
uint16_t mv_code = get_vlc2(gb, lc[level].mv_cb.table, lc[level].mv_cb.bits, 3);
- if (mv_code != lc[level].mv_esc) {
+ if (mv_code != MV_ESC) {
mv.x = (int8_t)(mv_code & 0xff);
mv.y = (int8_t)(mv_code >> 8);
} else {
@@ -383,7 +381,7 @@ static TileInfo* decode_tile_info(GetBitContext *gb, LevelCodes *lc, int level)
if (lc[level].bias_cb.table) {
uint16_t bias_val = get_vlc2(gb, lc[level].bias_cb.table, lc[level].bias_cb.bits, 2);
- if (bias_val != lc[level].bias_esc) {
+ if (bias_val != BIAS_ESC) {
bias = (int16_t)(bias_val);
} else {
bias = get_sbits(gb, 16);
@@ -728,7 +726,6 @@ static av_cold int clv_decode_init(AVCodecContext *avctx)
for (int i = 0, j = 0, k = 0;; i++) {
if (0x36F & (1 << i)) {
- c->lev[i].mv_esc = clv_mv_escape[i];
ret = build_vlc(&c->lev[i].mv_cb, clv_mv_len_counts[k], &mv_syms);
if (ret < 0)
return ret;
@@ -743,7 +740,6 @@ static av_cold int clv_decode_init(AVCodecContext *avctx)
if (ret < 0)
return ret;
- c->lev[i + 1].bias_esc = 0x100;
ret = build_vlc(&c->lev[i + 1].bias_cb,
clv_bias_len_counts[j], &bias_syms);
if (ret < 0)