28 #ifndef AVCODEC_H264_H
29 #define AVCODEC_H264_H
46 #define H264_MAX_PICTURE_COUNT 36
47 #define H264_MAX_THREADS 32
49 #define MAX_SPS_COUNT 32
50 #define MAX_PPS_COUNT 256
52 #define MAX_MMCO_COUNT 66
54 #define MAX_DELAYED_PIC_COUNT 16
56 #define MAX_MBPAIR_SIZE (256*1024) // a tighter bound could be calculated if someone cares about a few bytes
60 #define ALLOW_INTERLACE
70 #ifdef ALLOW_INTERLACE
71 #define MB_MBAFF(h) (h)->mb_mbaff
72 #define MB_FIELD(h) (h)->mb_field_decoding_flag
73 #define FRAME_MBAFF(h) (h)->mb_aff_frame
74 #define FIELD_PICTURE(h) ((h)->picture_structure != PICT_FRAME)
82 #define FRAME_MBAFF(h) 0
83 #define FIELD_PICTURE(h) 0
85 #define IS_INTERLACED(mb_type) 0
91 #define FIELD_OR_MBAFF_PICTURE(h) (FRAME_MBAFF(h) || FIELD_PICTURE(h))
94 #define CABAC(h) (h)->pps.cabac
97 #define CHROMA(h) ((h)->sps.chroma_format_idc)
98 #define CHROMA422(h) ((h)->sps.chroma_format_idc == 2)
99 #define CHROMA444(h) ((h)->sps.chroma_format_idc == 3)
101 #define EXTENDED_SAR 255
103 #define MB_TYPE_REF0 MB_TYPE_ACPRED // dirty but it fits in 16 bit
104 #define MB_TYPE_8x8DCT 0x01000000
105 #define IS_REF0(a) ((a) & MB_TYPE_REF0)
106 #define IS_8x8DCT(a) ((a) & MB_TYPE_8x8DCT)
108 #define QP_MAX_NUM (51 + 6*6) // The maximum supported qp
416 #define LIST_NOT_USED -1 // FIXME rename?
417 #define PART_NOT_AVAILABLE -2
729 #define FRAME_RECOVERED_IDR (1 << 0)
734 #define FRAME_RECOVERED_SEI (1 << 1)
800 int *dst_length,
int *consumed,
int length);
925 #define LUMA_DC_BLOCK_INDEX 48
926 #define CHROMA_DC_BLOCK_INDEX 49
930 4 + 1 * 8, 5 + 1 * 8, 4 + 2 * 8, 5 + 2 * 8,
931 6 + 1 * 8, 7 + 1 * 8, 6 + 2 * 8, 7 + 2 * 8,
932 4 + 3 * 8, 5 + 3 * 8, 4 + 4 * 8, 5 + 4 * 8,
933 6 + 3 * 8, 7 + 3 * 8, 6 + 4 * 8, 7 + 4 * 8,
934 4 + 6 * 8, 5 + 6 * 8, 4 + 7 * 8, 5 + 7 * 8,
935 6 + 6 * 8, 7 + 6 * 8, 6 + 7 * 8, 7 + 7 * 8,
936 4 + 8 * 8, 5 + 8 * 8, 4 + 9 * 8, 5 + 9 * 8,
937 6 + 8 * 8, 7 + 8 * 8, 6 + 9 * 8, 7 + 9 * 8,
938 4 + 11 * 8, 5 + 11 * 8, 4 + 12 * 8, 5 + 12 * 8,
939 6 + 11 * 8, 7 + 11 * 8, 6 + 12 * 8, 7 + 12 * 8,
940 4 + 13 * 8, 5 + 13 * 8, 4 + 14 * 8, 5 + 14 * 8,
941 6 + 13 * 8, 7 + 13 * 8, 6 + 14 * 8, 7 + 14 * 8,
942 0 + 0 * 8, 0 + 5 * 8, 0 + 10 * 8
948 return (b & 0xFFFF) + (a << 16);
950 return (a & 0xFFFF) + (b << 16);
957 return (b & 0xFF) + (a << 8);
959 return (a & 0xFF) + (b << 8);
976 const int index8 =
scan8[
n];
981 tprintf(h->
avctx,
"mode:%d %d min:%d\n", left, top, min);
995 i4x4[4] = i4x4_cache[7 + 8 * 3];
996 i4x4[5] = i4x4_cache[7 + 8 * 2];
997 i4x4[6] = i4x4_cache[7 + 8 * 1];
1006 AV_COPY32(&nnz[ 0], &nnz_cache[4 + 8 * 1]);
1007 AV_COPY32(&nnz[ 4], &nnz_cache[4 + 8 * 2]);
1008 AV_COPY32(&nnz[ 8], &nnz_cache[4 + 8 * 3]);
1009 AV_COPY32(&nnz[12], &nnz_cache[4 + 8 * 4]);
1010 AV_COPY32(&nnz[16], &nnz_cache[4 + 8 * 6]);
1011 AV_COPY32(&nnz[20], &nnz_cache[4 + 8 * 7]);
1012 AV_COPY32(&nnz[32], &nnz_cache[4 + 8 * 11]);
1013 AV_COPY32(&nnz[36], &nnz_cache[4 + 8 * 12]);
1016 AV_COPY32(&nnz[24], &nnz_cache[4 + 8 * 8]);
1017 AV_COPY32(&nnz[28], &nnz_cache[4 + 8 * 9]);
1018 AV_COPY32(&nnz[40], &nnz_cache[4 + 8 * 13]);
1019 AV_COPY32(&nnz[44], &nnz_cache[4 + 8 * 14]);
1025 int b_xy,
int b8_xy,
1026 int mb_type,
int list)
1030 AV_COPY128(mv_dst + 0 * b_stride, mv_src + 8 * 0);
1031 AV_COPY128(mv_dst + 1 * b_stride, mv_src + 8 * 1);
1032 AV_COPY128(mv_dst + 2 * b_stride, mv_src + 8 * 2);
1033 AV_COPY128(mv_dst + 3 * b_stride, mv_src + 8 * 3);
1042 AV_COPY16(mvd_dst + 3 + 3, mvd_src + 3 + 8 * 0);
1043 AV_COPY16(mvd_dst + 3 + 2, mvd_src + 3 + 8 * 1);
1044 AV_COPY16(mvd_dst + 3 + 1, mvd_src + 3 + 8 * 2);
1051 ref_index[0 + 0 * 2] = ref_cache[
scan8[0]];
1052 ref_index[1 + 0 * 2] = ref_cache[scan8[4]];
1053 ref_index[0 + 1 * 2] = ref_cache[scan8[8]];
1054 ref_index[1 + 1 * 2] = ref_cache[scan8[12]];
1062 const int b8_xy = 4 * h->
mb_xy;
1088 0x0001000100010001ULL));
1092 0x0001000100010001ULL));
1109 #define SLICE_SINGLETHREAD 1
1110 #define SLICE_SKIPED 2