[FFmpeg-devel] [PATCH 75/80] avcodec/mpegvideo: Move h263_long_vectors to H263DecContext
Andreas Rheinhardt
andreas.rheinhardt at outlook.com
Thu Feb 3 03:06:26 EET 2022
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt at outlook.com>
---
libavcodec/flvdec.c | 2 +-
libavcodec/h263dec.h | 1 +
libavcodec/intelh263dec.c | 2 +-
libavcodec/ituh263dec.c | 9 ++++++---
libavcodec/mpegvideo.h | 1 -
libavcodec/rv10.c | 2 +-
6 files changed, 10 insertions(+), 7 deletions(-)
diff --git a/libavcodec/flvdec.c b/libavcodec/flvdec.c
index 3c14f2c54c..8ff4c03100 100644
--- a/libavcodec/flvdec.c
+++ b/libavcodec/flvdec.c
@@ -92,7 +92,7 @@ int ff_flv_decode_picture_header(H263DecContext *h)
s->h263_plus = 0;
- s->h263_long_vectors = 0;
+ h->long_vectors = 0;
/* PEI */
if (skip_1stop_8data_bits(&s->gb) < 0)
diff --git a/libavcodec/h263dec.h b/libavcodec/h263dec.h
index 13e097358f..9c4c26242c 100644
--- a/libavcodec/h263dec.h
+++ b/libavcodec/h263dec.h
@@ -44,6 +44,7 @@ typedef struct H263DecContext {
MPVMainDecContext m;
int (*decode_mb)(MPVDecContext *s, int16_t block[12][64]); // used to avoid a switch
+ int long_vectors; ///< use horrible H.263v1 long vector mode
} H263DecContext;
int ff_h263_decode_motion(MPVDecContext *s, int pred, int f_code);
diff --git a/libavcodec/intelh263dec.c b/libavcodec/intelh263dec.c
index deed9152ea..f621c9686c 100644
--- a/libavcodec/intelh263dec.c
+++ b/libavcodec/intelh263dec.c
@@ -62,7 +62,7 @@ int ff_intel_h263_decode_picture_header(H263DecContext *h)
s->pict_type = AV_PICTURE_TYPE_I + get_bits1(&s->gb);
- s->h263_long_vectors = get_bits1(&s->gb);
+ h->long_vectors = get_bits1(&s->gb);
if (get_bits1(&s->gb) != 0) {
av_log(s->avctx, AV_LOG_ERROR, "SAC not supported\n");
diff --git a/libavcodec/ituh263dec.c b/libavcodec/ituh263dec.c
index 9e92ed94ce..299a668290 100644
--- a/libavcodec/ituh263dec.c
+++ b/libavcodec/ituh263dec.c
@@ -82,7 +82,7 @@ void ff_h263_show_pict_info(H263DecContext *h)
s->gb.size_in_bits, 1-s->no_rounding,
s->obmc ? " AP" : "",
s->umvplus ? " UMV" : "",
- s->h263_long_vectors ? " LONG" : "",
+ h->long_vectors ? " LONG" : "",
s->h263_plus ? " +" : "",
s->h263_aic ? " AIC" : "",
s->alt_inter_vlc ? " AIV" : "",
@@ -272,6 +272,9 @@ int ff_h263_resync(MPVMainDecContext *m)
int ff_h263_decode_motion(MPVDecContext *s, int pred, int f_code)
{
+ /* The following is only allowed because no h263dec-based
+ * decoder uses slice-threading. */
+ const H263DecContext *const h = (H263DecContext*)s;
int code, val, sign, shift;
code = get_vlc2(&s->gb, ff_h263_mv_vlc.table, H263_MV_VLC_BITS, 2);
@@ -293,7 +296,7 @@ int ff_h263_decode_motion(MPVDecContext *s, int pred, int f_code)
val += pred;
/* modulo decoding */
- if (!s->h263_long_vectors) {
+ if (!h->long_vectors) {
val = sign_extend(val, 5 + f_code);
} else {
/* horrible H.263 long vector mode */
@@ -1150,7 +1153,7 @@ int ff_h263_decode_picture_header(H263DecContext *h)
s->pict_type = AV_PICTURE_TYPE_I + get_bits1(&s->gb);
- s->h263_long_vectors = get_bits1(&s->gb);
+ h->long_vectors = get_bits1(&s->gb);
if (get_bits1(&s->gb) != 0) {
av_log(s->avctx, AV_LOG_ERROR, "H.263 SAC not supported\n");
diff --git a/libavcodec/mpegvideo.h b/libavcodec/mpegvideo.h
index d0e4e8e9ff..0e26bed7fd 100644
--- a/libavcodec/mpegvideo.h
+++ b/libavcodec/mpegvideo.h
@@ -177,7 +177,6 @@ typedef struct MPVContext {
/* motion compensation */
int unrestricted_mv; ///< mv can point outside of the coded picture
- int h263_long_vectors; ///< use horrible H.263v1 long vector mode
BlockDSPContext bdsp;
FDCTDSPContext fdsp;
diff --git a/libavcodec/rv10.c b/libavcodec/rv10.c
index 1fbd99a965..e1379b634c 100644
--- a/libavcodec/rv10.c
+++ b/libavcodec/rv10.c
@@ -390,7 +390,7 @@ static av_cold int rv10_decode_init(AVCodecContext *avctx)
rv->orig_height =
s->height = avctx->coded_height;
- s->h263_long_vectors = ((uint8_t *) avctx->extradata)[3] & 1;
+ h->long_vectors = avctx->extradata[3] & 1;
rv->sub_id = AV_RB32((uint8_t *) avctx->extradata + 4);
major_ver = RV_GET_MAJOR_VER(rv->sub_id);
--
2.32.0
More information about the ffmpeg-devel
mailing list