History

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.

Andreas Rheinhardt committed 2 years ago

Commit dd1e8041 parent 5805b863 files · +6 −3Browse files

Unified · Split

3 files
  1. libavcodec/h264_parse.h +1 −1
  2. libavcodec/mpegutils.c +1 −1
  3. libavcodec/mpegutils.h +4 −1
libavcodec/h264_parse.h+1−1
@@ -33,7 +33,7 @@ · 32 unmodified lines
33#include "get_bits.h"33#include "get_bits.h"
34#include "h264_ps.h"34#include "h264_ps.h"
35 35
36#define MB_TYPE_REF0 MB_TYPE_ACPRED // dirty but it fits in 16 bit36#define MB_TYPE_REF0 MB_TYPE_CODEC_SPECIFIC
37#define MB_TYPE_8x8DCT 0x0100000037#define MB_TYPE_8x8DCT 0x01000000
38 38
39// This table must be here because scan8[constant] must be known at compiletime39// This table must be here because scan8[constant] must be known at compiletime
libavcodec/mpegutils.c+1−1
@@ -109,7 +109,7 @@ static char get_type_mv_char(int mb_type) · 108 unmodified lines
109 // Type & MV direction109 // Type & MV direction
110 if (IS_PCM(mb_type))110 if (IS_PCM(mb_type))
111 return 'P';111 return 'P';
112 else if (IS_INTRA(mb_type) && IS_ACPRED(mb_type))112 else if (IS_ACPRED(mb_type))
113 return 'A';113 return 'A';
114 else if (IS_INTRA4x4(mb_type))114 else if (IS_INTRA4x4(mb_type))
115 return 'i';115 return 'i';
libavcodec/mpegutils.h+4−1
@@ -45,7 +45,6 @@ · 44 unmodified lines
45#define MB_TYPE_8x8 (1 << 6)45#define MB_TYPE_8x8 (1 << 6)
46#define MB_TYPE_INTERLACED (1 << 7)46#define MB_TYPE_INTERLACED (1 << 7)
47#define MB_TYPE_DIRECT2 (1 << 8) // FIXME47#define MB_TYPE_DIRECT2 (1 << 8) // FIXME
48#define MB_TYPE_ACPRED (1 << 9)
49#define MB_TYPE_GMC (1 << 10)48#define MB_TYPE_GMC (1 << 10)
50#define MB_TYPE_SKIP (1 << 11)49#define MB_TYPE_SKIP (1 << 11)
51#define MB_TYPE_P0L0 (1 << 12)50#define MB_TYPE_P0L0 (1 << 12)
@@ -57,9 +56,13 @@ · 5 unmodified lines
57#define MB_TYPE_L0L1 (MB_TYPE_L0 | MB_TYPE_L1)56#define MB_TYPE_L0L1 (MB_TYPE_L0 | MB_TYPE_L1)
58#define MB_TYPE_QUANT (1 << 16)57#define MB_TYPE_QUANT (1 << 16)
59#define MB_TYPE_CBP (1 << 17)58#define MB_TYPE_CBP (1 << 17)
59#define MB_TYPE_ACPRED (1 << 18)
60 60
61#define MB_TYPE_INTRA MB_TYPE_INTRA4x4 // default mb_type if there is just one type61#define MB_TYPE_INTRA MB_TYPE_INTRA4x4 // default mb_type if there is just one type
62 62
63// The following MB-type can be used by each codec as it sees fit.
64#define MB_TYPE_CODEC_SPECIFIC (1 << 9)
65
63#define IS_INTRA4x4(a) ((a) & MB_TYPE_INTRA4x4)66#define IS_INTRA4x4(a) ((a) & MB_TYPE_INTRA4x4)
64#define IS_INTRA16x16(a) ((a) & MB_TYPE_INTRA16x16)67#define IS_INTRA16x16(a) ((a) & MB_TYPE_INTRA16x16)
65#define IS_PCM(a) ((a) & MB_TYPE_INTRA_PCM)68#define IS_PCM(a) ((a) & MB_TYPE_INTRA_PCM)

Keyboard shortcuts

General

Show keyboard shortcuts
?
Focus the current search
/

Issues and pull requests

Open filters
f

Issues, pull requests and Inbox

Select next item
j↓
Select previous item
k↑
Open selected item
Enter
Dismiss filters or clear selection
Esc

Repository code

Go to file
t