28 #ifndef AVCODEC_H264_H
29 #define AVCODEC_H264_H
47 #define H264_MAX_PICTURE_COUNT 36
48 #define H264_MAX_THREADS 32
50 #define MAX_SPS_COUNT 32
51 #define MAX_PPS_COUNT 256
53 #define MAX_MMCO_COUNT 66
55 #define MAX_DELAYED_PIC_COUNT 16
57 #define MAX_MBPAIR_SIZE (256*1024) // a tighter bound could be calculated if someone cares about a few bytes
61 #define ALLOW_INTERLACE
71 #ifdef ALLOW_INTERLACE
72 #define MB_MBAFF(h) (h)->mb_mbaff
73 #define MB_FIELD(h) (h)->mb_field_decoding_flag
74 #define FRAME_MBAFF(h) (h)->mb_aff_frame
75 #define FIELD_PICTURE(h) ((h)->picture_structure != PICT_FRAME)
83 #define FRAME_MBAFF(h) 0
84 #define FIELD_PICTURE(h) 0
86 #define IS_INTERLACED(mb_type) 0
92 #define FIELD_OR_MBAFF_PICTURE(h) (FRAME_MBAFF(h) || FIELD_PICTURE(h))
95 #define CABAC(h) (h)->pps.cabac
98 #define CHROMA(h) ((h)->sps.chroma_format_idc)
99 #define CHROMA422(h) ((h)->sps.chroma_format_idc == 2)
100 #define CHROMA444(h) ((h)->sps.chroma_format_idc == 3)
102 #define EXTENDED_SAR 255
104 #define MB_TYPE_REF0 MB_TYPE_ACPRED // dirty but it fits in 16 bit
105 #define MB_TYPE_8x8DCT 0x01000000
106 #define IS_REF0(a) ((a) & MB_TYPE_REF0)
107 #define IS_8x8DCT(a) ((a) & MB_TYPE_8x8DCT)
109 #define QP_MAX_NUM (51 + 6*6) // The maximum supported qp
417 #define LIST_NOT_USED -1 // FIXME rename?
418 #define PART_NOT_AVAILABLE -2
730 #define FRAME_RECOVERED_IDR (1 << 0)
735 #define FRAME_RECOVERED_SEI (1 << 1)
801 int *dst_length,
int *consumed,
int length);
926 #define LUMA_DC_BLOCK_INDEX 48
927 #define CHROMA_DC_BLOCK_INDEX 49
931 4 + 1 * 8, 5 + 1 * 8, 4 + 2 * 8, 5 + 2 * 8,
932 6 + 1 * 8, 7 + 1 * 8, 6 + 2 * 8, 7 + 2 * 8,
933 4 + 3 * 8, 5 + 3 * 8, 4 + 4 * 8, 5 + 4 * 8,
934 6 + 3 * 8, 7 + 3 * 8, 6 + 4 * 8, 7 + 4 * 8,
935 4 + 6 * 8, 5 + 6 * 8, 4 + 7 * 8, 5 + 7 * 8,
936 6 + 6 * 8, 7 + 6 * 8, 6 + 7 * 8, 7 + 7 * 8,
937 4 + 8 * 8, 5 + 8 * 8, 4 + 9 * 8, 5 + 9 * 8,
938 6 + 8 * 8, 7 + 8 * 8, 6 + 9 * 8, 7 + 9 * 8,
939 4 + 11 * 8, 5 + 11 * 8, 4 + 12 * 8, 5 + 12 * 8,
940 6 + 11 * 8, 7 + 11 * 8, 6 + 12 * 8, 7 + 12 * 8,
941 4 + 13 * 8, 5 + 13 * 8, 4 + 14 * 8, 5 + 14 * 8,
942 6 + 13 * 8, 7 + 13 * 8, 6 + 14 * 8, 7 + 14 * 8,
943 0 + 0 * 8, 0 + 5 * 8, 0 + 10 * 8
949 return (b & 0xFFFF) + (a << 16);
951 return (a & 0xFFFF) + (b << 16);
958 return (b & 0xFF) + (a << 8);
960 return (a & 0xFF) + (b << 8);
977 const int index8 =
scan8[
n];
982 tprintf(h->
avctx,
"mode:%d %d min:%d\n", left, top, min);
996 i4x4[4] = i4x4_cache[7 + 8 * 3];
997 i4x4[5] = i4x4_cache[7 + 8 * 2];
998 i4x4[6] = i4x4_cache[7 + 8 * 1];
1007 AV_COPY32(&nnz[ 0], &nnz_cache[4 + 8 * 1]);
1008 AV_COPY32(&nnz[ 4], &nnz_cache[4 + 8 * 2]);
1009 AV_COPY32(&nnz[ 8], &nnz_cache[4 + 8 * 3]);
1010 AV_COPY32(&nnz[12], &nnz_cache[4 + 8 * 4]);
1011 AV_COPY32(&nnz[16], &nnz_cache[4 + 8 * 6]);
1012 AV_COPY32(&nnz[20], &nnz_cache[4 + 8 * 7]);
1013 AV_COPY32(&nnz[32], &nnz_cache[4 + 8 * 11]);
1014 AV_COPY32(&nnz[36], &nnz_cache[4 + 8 * 12]);
1017 AV_COPY32(&nnz[24], &nnz_cache[4 + 8 * 8]);
1018 AV_COPY32(&nnz[28], &nnz_cache[4 + 8 * 9]);
1019 AV_COPY32(&nnz[40], &nnz_cache[4 + 8 * 13]);
1020 AV_COPY32(&nnz[44], &nnz_cache[4 + 8 * 14]);
1026 int b_xy,
int b8_xy,
1027 int mb_type,
int list)
1031 AV_COPY128(mv_dst + 0 * b_stride, mv_src + 8 * 0);
1032 AV_COPY128(mv_dst + 1 * b_stride, mv_src + 8 * 1);
1033 AV_COPY128(mv_dst + 2 * b_stride, mv_src + 8 * 2);
1034 AV_COPY128(mv_dst + 3 * b_stride, mv_src + 8 * 3);
1043 AV_COPY16(mvd_dst + 3 + 3, mvd_src + 3 + 8 * 0);
1044 AV_COPY16(mvd_dst + 3 + 2, mvd_src + 3 + 8 * 1);
1045 AV_COPY16(mvd_dst + 3 + 1, mvd_src + 3 + 8 * 2);
1052 ref_index[0 + 0 * 2] = ref_cache[
scan8[0]];
1053 ref_index[1 + 0 * 2] = ref_cache[scan8[4]];
1054 ref_index[0 + 1 * 2] = ref_cache[scan8[8]];
1055 ref_index[1 + 1 * 2] = ref_cache[scan8[12]];
1063 const int b8_xy = 4 * h->
mb_xy;
1089 0x0001000100010001ULL));
1093 0x0001000100010001ULL));
1097 int buf_index,
int next_avc)
1099 uint32_t
state = -1;
1103 return FFMIN(buf_index, buf_size);
1107 int buf_size,
int *buf_index)
1115 nalsize = ((
unsigned)nalsize << 8) | buf[(*buf_index)++];
1116 if (nalsize <= 0 || nalsize > buf_size - *buf_index) {
1118 "AVC: nal size %d\n", nalsize);
1138 #define SLICE_SINGLETHREAD 1
1139 #define SLICE_SKIPED 2