aboutsummaryrefslogtreecommitdiffstats
path: root/libavcodec
diff options
context:
space:
mode:
authorAndreas Rheinhardt <andreas.rheinhardt@outlook.com>2024-06-02 09:07:33 +0200
committerAndreas Rheinhardt <andreas.rheinhardt@outlook.com>2024-06-20 18:58:38 +0200
commitdd1e804a987d7464d9bfd7c25dd9ef295223bd36 (patch)
tree5dadc4d0f1131262e726037d9046e94c9058b6d7 /libavcodec
parent5805b860fe713177430f26b8617bb2bc3c2e7e8f (diff)
downloadffmpeg-dd1e804a987d7464d9bfd7c25dd9ef295223bd36.tar.gz
avcodec/mpegutils: Remap MB_TYPE_ACPRED, add codec-specific MB_TYPE
MB_TYPE_ACPRED is currently reused for MB_TYPE_REF0 by H.264, so that the value fits into an uint16_t. Given that MB_TYPE_ACPRED is not subject to any such restriction (apart from fitting into 32bits), it can be remapped to a hithereto unused bit. The then available bit will be declared to be codec-specific (i.e. unused by generic code), so that H.264 can use it for MB_TYPE_REF0 and so that it can be reused later for e.g. MB_TYPE_H261_FIL. Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
Diffstat (limited to 'libavcodec')
-rw-r--r--libavcodec/h264_parse.h2
-rw-r--r--libavcodec/mpegutils.c2
-rw-r--r--libavcodec/mpegutils.h5
3 files changed, 6 insertions, 3 deletions
diff --git a/libavcodec/h264_parse.h b/libavcodec/h264_parse.h
index 4ee863df66..3481451c10 100644
--- a/libavcodec/h264_parse.h
+++ b/libavcodec/h264_parse.h
@@ -33,7 +33,7 @@
#include "get_bits.h"
#include "h264_ps.h"
-#define MB_TYPE_REF0 MB_TYPE_ACPRED // dirty but it fits in 16 bit
+#define MB_TYPE_REF0 MB_TYPE_CODEC_SPECIFIC
#define MB_TYPE_8x8DCT 0x01000000
// This table must be here because scan8[constant] must be known at compiletime
diff --git a/libavcodec/mpegutils.c b/libavcodec/mpegutils.c
index 92ebdd3a98..4b1bcaa995 100644
--- a/libavcodec/mpegutils.c
+++ b/libavcodec/mpegutils.c
@@ -109,7 +109,7 @@ static char get_type_mv_char(int mb_type)
// Type & MV direction
if (IS_PCM(mb_type))
return 'P';
- else if (IS_INTRA(mb_type) && IS_ACPRED(mb_type))
+ else if (IS_ACPRED(mb_type))
return 'A';
else if (IS_INTRA4x4(mb_type))
return 'i';
diff --git a/libavcodec/mpegutils.h b/libavcodec/mpegutils.h
index 3da1e7ed38..0cca4f0a2f 100644
--- a/libavcodec/mpegutils.h
+++ b/libavcodec/mpegutils.h
@@ -45,7 +45,6 @@
#define MB_TYPE_8x8 (1 << 6)
#define MB_TYPE_INTERLACED (1 << 7)
#define MB_TYPE_DIRECT2 (1 << 8) // FIXME
-#define MB_TYPE_ACPRED (1 << 9)
#define MB_TYPE_GMC (1 << 10)
#define MB_TYPE_SKIP (1 << 11)
#define MB_TYPE_P0L0 (1 << 12)
@@ -57,9 +56,13 @@
#define MB_TYPE_L0L1 (MB_TYPE_L0 | MB_TYPE_L1)
#define MB_TYPE_QUANT (1 << 16)
#define MB_TYPE_CBP (1 << 17)
+#define MB_TYPE_ACPRED (1 << 18)
#define MB_TYPE_INTRA MB_TYPE_INTRA4x4 // default mb_type if there is just one type
+// The following MB-type can be used by each codec as it sees fit.
+#define MB_TYPE_CODEC_SPECIFIC (1 << 9)
+
#define IS_INTRA4x4(a) ((a) & MB_TYPE_INTRA4x4)
#define IS_INTRA16x16(a) ((a) & MB_TYPE_INTRA16x16)
#define IS_PCM(a) ((a) & MB_TYPE_INTRA_PCM)