Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Contribute to GitLab
Sign in / Register
Toggle navigation
F
ffmpeg.wasm-core
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Linshizhi
ffmpeg.wasm-core
Commits
a7da517f
Commit
a7da517f
authored
Aug 19, 2013
by
Diego Biurrun
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
h264data: Move all data tables from a header to a .c file
parent
f4d581cd
Hide whitespace changes
Inline
Side-by-side
Showing
9 changed files
with
204 additions
and
164 deletions
+204
-164
Makefile
libavcodec/Makefile
+2
-1
dxva2_h264.c
libavcodec/dxva2_h264.c
+1
-1
h264_cabac.c
libavcodec/h264_cabac.c
+14
-13
h264_cavlc.c
libavcodec/h264_cavlc.c
+19
-16
h264_parser.c
libavcodec/h264_parser.c
+1
-1
h264_slice.c
libavcodec/h264_slice.c
+1
-1
h264data.c
libavcodec/h264data.c
+149
-0
h264data.h
libavcodec/h264data.h
+10
-122
svq3.c
libavcodec/svq3.c
+7
-9
No files found.
libavcodec/Makefile
View file @
a7da517f
...
...
@@ -251,7 +251,8 @@ OBJS-$(CONFIG_H263_ENCODER) += mpeg4videoenc.o mpeg4video.o \
OBJS-$(CONFIG_H264_DECODER)
+=
h264.o
h264_cabac.o
h264_cavlc.o
\
h264_direct.o
h264_loopfilter.o
\
h264_mb.o
h264_picture.o
h264_ps.o
\
h264_refs.o
h264_sei.o
h264_slice.o
h264_refs.o
h264_sei.o
\
h264_slice.o
h264data.o
OBJS-$(CONFIG_H264_MMAL_DECODER)
+=
mmaldec.o
OBJS-$(CONFIG_H264_NVENC_ENCODER)
+=
nvenc_h264.o
OBJS-$(CONFIG_H264_QSV_DECODER)
+=
qsvdec_h2645.o
...
...
libavcodec/dxva2_h264.c
View file @
a7da517f
...
...
@@ -176,7 +176,7 @@ static void fill_scaling_lists(const AVCodecContext *avctx, AVDXVAContext *ctx,
}
else
{
for
(
i
=
0
;
i
<
6
;
i
++
)
for
(
j
=
0
;
j
<
16
;
j
++
)
qm
->
bScalingLists4x4
[
i
][
j
]
=
h
->
pps
.
scaling_matrix4
[
i
][
zigzag_scan
[
j
]];
qm
->
bScalingLists4x4
[
i
][
j
]
=
h
->
pps
.
scaling_matrix4
[
i
][
ff_
zigzag_scan
[
j
]];
for
(
i
=
0
;
i
<
64
;
i
++
)
{
qm
->
bScalingLists8x8
[
0
][
i
]
=
h
->
pps
.
scaling_matrix8
[
0
][
ff_zigzag_direct
[
i
]];
...
...
libavcodec/h264_cabac.c
View file @
a7da517f
...
...
@@ -1986,8 +1986,8 @@ int ff_h264_decode_mb_cabac(const H264Context *h, H264SliceContext *sl)
mb_type
=
bits
-
4
;
/* B_L0_Bi_* through B_Bi_Bi_* */
}
}
partition_count
=
b_mb_type_info
[
mb_type
].
partition_count
;
mb_type
=
b_mb_type_info
[
mb_type
].
type
;
partition_count
=
ff_h264_
b_mb_type_info
[
mb_type
].
partition_count
;
mb_type
=
ff_h264_
b_mb_type_info
[
mb_type
].
type
;
}
else
if
(
sl
->
slice_type_nos
==
AV_PICTURE_TYPE_P
)
{
if
(
get_cabac_noinline
(
&
sl
->
cabac
,
&
sl
->
cabac_state
[
14
]
)
==
0
)
{
/* P-type */
...
...
@@ -1998,8 +1998,8 @@ int ff_h264_decode_mb_cabac(const H264Context *h, H264SliceContext *sl)
/* P_L0_D8x16, P_L0_D16x8 */
mb_type
=
2
-
get_cabac_noinline
(
&
sl
->
cabac
,
&
sl
->
cabac_state
[
17
]
);
}
partition_count
=
p_mb_type_info
[
mb_type
].
partition_count
;
mb_type
=
p_mb_type_info
[
mb_type
].
type
;
partition_count
=
ff_h264_
p_mb_type_info
[
mb_type
].
partition_count
;
mb_type
=
ff_h264_
p_mb_type_info
[
mb_type
].
type
;
}
else
{
mb_type
=
decode_cabac_intra_mb_type
(
sl
,
17
,
0
);
goto
decode_intra_mb
;
...
...
@@ -2011,9 +2011,9 @@ int ff_h264_decode_mb_cabac(const H264Context *h, H264SliceContext *sl)
assert
(
sl
->
slice_type_nos
==
AV_PICTURE_TYPE_I
);
decode_intra_mb:
partition_count
=
0
;
cbp
=
i_mb_type_info
[
mb_type
].
cbp
;
sl
->
intra16x16_pred_mode
=
i_mb_type_info
[
mb_type
].
pred_mode
;
mb_type
=
i_mb_type_info
[
mb_type
].
type
;
cbp
=
ff_h264_
i_mb_type_info
[
mb_type
].
cbp
;
sl
->
intra16x16_pred_mode
=
ff_h264_
i_mb_type_info
[
mb_type
].
pred_mode
;
mb_type
=
ff_h264_
i_mb_type_info
[
mb_type
].
type
;
}
if
(
MB_FIELD
(
sl
))
mb_type
|=
MB_TYPE_INTERLACED
;
...
...
@@ -2097,8 +2097,8 @@ decode_intra_mb:
if
(
sl
->
slice_type_nos
==
AV_PICTURE_TYPE_B
)
{
for
(
i
=
0
;
i
<
4
;
i
++
)
{
sl
->
sub_mb_type
[
i
]
=
decode_cabac_b_mb_sub_type
(
sl
);
sub_partition_count
[
i
]
=
b_sub_mb_type_info
[
sl
->
sub_mb_type
[
i
]].
partition_count
;
sl
->
sub_mb_type
[
i
]
=
b_sub_mb_type_info
[
sl
->
sub_mb_type
[
i
]].
type
;
sub_partition_count
[
i
]
=
ff_h264_
b_sub_mb_type_info
[
sl
->
sub_mb_type
[
i
]].
partition_count
;
sl
->
sub_mb_type
[
i
]
=
ff_h264_
b_sub_mb_type_info
[
sl
->
sub_mb_type
[
i
]].
type
;
}
if
(
IS_DIRECT
(
sl
->
sub_mb_type
[
0
]
|
sl
->
sub_mb_type
[
1
]
|
sl
->
sub_mb_type
[
2
]
|
sl
->
sub_mb_type
[
3
]))
{
...
...
@@ -2113,8 +2113,8 @@ decode_intra_mb:
}
else
{
for
(
i
=
0
;
i
<
4
;
i
++
)
{
sl
->
sub_mb_type
[
i
]
=
decode_cabac_p_mb_sub_type
(
sl
);
sub_partition_count
[
i
]
=
p_sub_mb_type_info
[
sl
->
sub_mb_type
[
i
]].
partition_count
;
sl
->
sub_mb_type
[
i
]
=
p_sub_mb_type_info
[
sl
->
sub_mb_type
[
i
]].
type
;
sub_partition_count
[
i
]
=
ff_h264_
p_sub_mb_type_info
[
sl
->
sub_mb_type
[
i
]].
partition_count
;
sl
->
sub_mb_type
[
i
]
=
ff_h264_
p_sub_mb_type_info
[
sl
->
sub_mb_type
[
i
]].
type
;
}
}
...
...
@@ -2397,7 +2397,7 @@ decode_intra_mb:
for
(
c
=
0
;
c
<
2
;
c
++
)
decode_cabac_residual_dc_422
(
h
,
sl
,
sl
->
mb
+
((
256
+
16
*
16
*
c
)
<<
pixel_shift
),
3
,
CHROMA_DC_BLOCK_INDEX
+
c
,
chroma422_dc_scan
,
8
);
ff_h264_
chroma422_dc_scan
,
8
);
}
if
(
cbp
&
0x20
)
{
...
...
@@ -2421,7 +2421,8 @@ decode_intra_mb:
if
(
cbp
&
0x30
){
int
c
;
for
(
c
=
0
;
c
<
2
;
c
++
)
decode_cabac_residual_dc
(
h
,
sl
,
sl
->
mb
+
((
256
+
16
*
16
*
c
)
<<
pixel_shift
),
3
,
CHROMA_DC_BLOCK_INDEX
+
c
,
chroma_dc_scan
,
4
);
decode_cabac_residual_dc
(
h
,
sl
,
sl
->
mb
+
((
256
+
16
*
16
*
c
)
<<
pixel_shift
),
3
,
CHROMA_DC_BLOCK_INDEX
+
c
,
ff_h264_chroma_dc_scan
,
4
);
}
if
(
cbp
&
0x20
)
{
...
...
libavcodec/h264_cavlc.c
View file @
a7da517f
...
...
@@ -30,8 +30,8 @@
#include "internal.h"
#include "avcodec.h"
#include "h264.h"
#include "h264data.h" // FIXME FIXME FIXME
#include "h264_mvpred.h"
#include "h264data.h"
#include "golomb.h"
#include "mpegutils.h"
...
...
@@ -733,16 +733,16 @@ int ff_h264_decode_mb_cavlc(const H264Context *h, H264SliceContext *sl)
mb_type
=
get_ue_golomb
(
&
sl
->
gb
);
if
(
sl
->
slice_type_nos
==
AV_PICTURE_TYPE_B
)
{
if
(
mb_type
<
23
){
partition_count
=
b_mb_type_info
[
mb_type
].
partition_count
;
mb_type
=
b_mb_type_info
[
mb_type
].
type
;
partition_count
=
ff_h264_
b_mb_type_info
[
mb_type
].
partition_count
;
mb_type
=
ff_h264_
b_mb_type_info
[
mb_type
].
type
;
}
else
{
mb_type
-=
23
;
goto
decode_intra_mb
;
}
}
else
if
(
sl
->
slice_type_nos
==
AV_PICTURE_TYPE_P
)
{
if
(
mb_type
<
5
){
partition_count
=
p_mb_type_info
[
mb_type
].
partition_count
;
mb_type
=
p_mb_type_info
[
mb_type
].
type
;
partition_count
=
ff_h264_
p_mb_type_info
[
mb_type
].
partition_count
;
mb_type
=
ff_h264_
p_mb_type_info
[
mb_type
].
type
;
}
else
{
mb_type
-=
5
;
goto
decode_intra_mb
;
...
...
@@ -757,9 +757,9 @@ decode_intra_mb:
return
-
1
;
}
partition_count
=
0
;
cbp
=
i_mb_type_info
[
mb_type
].
cbp
;
sl
->
intra16x16_pred_mode
=
i_mb_type_info
[
mb_type
].
pred_mode
;
mb_type
=
i_mb_type_info
[
mb_type
].
type
;
cbp
=
ff_h264_
i_mb_type_info
[
mb_type
].
cbp
;
sl
->
intra16x16_pred_mode
=
ff_h264_
i_mb_type_info
[
mb_type
].
pred_mode
;
mb_type
=
ff_h264_
i_mb_type_info
[
mb_type
].
type
;
}
if
(
MB_FIELD
(
sl
))
...
...
@@ -843,8 +843,8 @@ decode_intra_mb:
av_log
(
h
->
avctx
,
AV_LOG_ERROR
,
"B sub_mb_type %u out of range at %d %d
\n
"
,
sl
->
sub_mb_type
[
i
],
sl
->
mb_x
,
sl
->
mb_y
);
return
-
1
;
}
sub_partition_count
[
i
]
=
b_sub_mb_type_info
[
sl
->
sub_mb_type
[
i
]
].
partition_count
;
sl
->
sub_mb_type
[
i
]
=
b_sub_mb_type_info
[
sl
->
sub_mb_type
[
i
]
].
type
;
sub_partition_count
[
i
]
=
ff_h264_b_sub_mb_type_info
[
sl
->
sub_mb_type
[
i
]
].
partition_count
;
sl
->
sub_mb_type
[
i
]
=
ff_h264_b_sub_mb_type_info
[
sl
->
sub_mb_type
[
i
]
].
type
;
}
if
(
IS_DIRECT
(
sl
->
sub_mb_type
[
0
]
|
sl
->
sub_mb_type
[
1
]
|
sl
->
sub_mb_type
[
2
]
|
sl
->
sub_mb_type
[
3
]))
{
ff_h264_pred_direct_motion
(
h
,
sl
,
&
mb_type
);
...
...
@@ -861,8 +861,8 @@ decode_intra_mb:
av_log
(
h
->
avctx
,
AV_LOG_ERROR
,
"P sub_mb_type %u out of range at %d %d
\n
"
,
sl
->
sub_mb_type
[
i
],
sl
->
mb_x
,
sl
->
mb_y
);
return
-
1
;
}
sub_partition_count
[
i
]
=
p_sub_mb_type_info
[
sl
->
sub_mb_type
[
i
]
].
partition_count
;
sl
->
sub_mb_type
[
i
]
=
p_sub_mb_type_info
[
sl
->
sub_mb_type
[
i
]
].
type
;
sub_partition_count
[
i
]
=
ff_h264_p_sub_mb_type_info
[
sl
->
sub_mb_type
[
i
]
].
partition_count
;
sl
->
sub_mb_type
[
i
]
=
ff_h264_p_sub_mb_type_info
[
sl
->
sub_mb_type
[
i
]
].
type
;
}
}
...
...
@@ -1062,8 +1062,10 @@ decode_intra_mb:
av_log
(
h
->
avctx
,
AV_LOG_ERROR
,
"cbp too large (%u) at %d %d
\n
"
,
cbp
,
sl
->
mb_x
,
sl
->
mb_y
);
return
-
1
;
}
if
(
IS_INTRA4x4
(
mb_type
))
cbp
=
golomb_to_intra4x4_cbp
[
cbp
];
else
cbp
=
golomb_to_inter_cbp
[
cbp
];
if
(
IS_INTRA4x4
(
mb_type
))
cbp
=
ff_h264_golomb_to_intra4x4_cbp
[
cbp
];
else
cbp
=
ff_h264_golomb_to_inter_cbp
[
cbp
];
}
else
{
if
(
cbp
>
15
){
av_log
(
h
->
avctx
,
AV_LOG_ERROR
,
"cbp too large (%u) at %d %d
\n
"
,
cbp
,
sl
->
mb_x
,
sl
->
mb_y
);
...
...
@@ -1128,7 +1130,7 @@ decode_intra_mb:
if
(
cbp
&
0x30
){
for
(
chroma_idx
=
0
;
chroma_idx
<
2
;
chroma_idx
++
)
if
(
decode_residual
(
h
,
sl
,
gb
,
sl
->
mb
+
((
256
+
16
*
16
*
chroma_idx
)
<<
pixel_shift
),
CHROMA_DC_BLOCK_INDEX
+
chroma_idx
,
chroma422_dc_scan
,
CHROMA_DC_BLOCK_INDEX
+
chroma_idx
,
ff_h264_
chroma422_dc_scan
,
NULL
,
8
)
<
0
)
{
return
-
1
;
}
...
...
@@ -1154,7 +1156,8 @@ decode_intra_mb:
}
else
/* yuv420 */
{
if
(
cbp
&
0x30
){
for
(
chroma_idx
=
0
;
chroma_idx
<
2
;
chroma_idx
++
)
if
(
decode_residual
(
h
,
sl
,
gb
,
sl
->
mb
+
((
256
+
16
*
16
*
chroma_idx
)
<<
pixel_shift
),
CHROMA_DC_BLOCK_INDEX
+
chroma_idx
,
chroma_dc_scan
,
NULL
,
4
)
<
0
){
if
(
decode_residual
(
h
,
sl
,
gb
,
sl
->
mb
+
((
256
+
16
*
16
*
chroma_idx
)
<<
pixel_shift
),
CHROMA_DC_BLOCK_INDEX
+
chroma_idx
,
ff_h264_chroma_dc_scan
,
NULL
,
4
)
<
0
)
{
return
-
1
;
}
}
...
...
libavcodec/h264_parser.c
View file @
a7da517f
...
...
@@ -261,7 +261,7 @@ static inline int parse_nal_units(AVCodecParserContext *s,
init_get_bits
(
&
sl
->
gb
,
ptr
,
8
*
dst_length
);
get_ue_golomb
(
&
sl
->
gb
);
// skip first_mb_in_slice
slice_type
=
get_ue_golomb_31
(
&
sl
->
gb
);
s
->
pict_type
=
golomb_to_pict_type
[
slice_type
%
5
];
s
->
pict_type
=
ff_h264_
golomb_to_pict_type
[
slice_type
%
5
];
if
(
h
->
sei_recovery_frame_cnt
>=
0
)
{
/* key frame, since recovery_frame_cnt is set */
s
->
key_frame
=
1
;
...
...
libavcodec/h264_slice.c
View file @
a7da517f
...
...
@@ -1081,7 +1081,7 @@ int ff_h264_decode_slice_header(H264Context *h, H264SliceContext *sl)
}
else
sl
->
slice_type_fixed
=
0
;
slice_type
=
golomb_to_pict_type
[
slice_type
];
slice_type
=
ff_h264_
golomb_to_pict_type
[
slice_type
];
sl
->
slice_type
=
slice_type
;
sl
->
slice_type_nos
=
slice_type
&
3
;
...
...
libavcodec/h264data.c
0 → 100644
View file @
a7da517f
/*
* H26L/H264/AVC/JVT/14496-10/... encoder/decoder
* Copyright (c) 2003 Michael Niedermayer <michaelni@gmx.at>
*
* This file is part of Libav.
*
* Libav is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2.1 of the License, or (at your option) any later version.
*
* Libav is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with Libav; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*/
/**
* @file
* @brief
* H264 / AVC / MPEG4 part10 codec data table
* @author Michael Niedermayer <michaelni@gmx.at>
*/
#include <stdint.h>
#include "libavutil/avutil.h"
#include "avcodec.h"
#include "h264data.h"
const
uint8_t
ff_h264_golomb_to_pict_type
[
5
]
=
{
AV_PICTURE_TYPE_P
,
AV_PICTURE_TYPE_B
,
AV_PICTURE_TYPE_I
,
AV_PICTURE_TYPE_SP
,
AV_PICTURE_TYPE_SI
};
const
uint8_t
ff_h264_golomb_to_intra4x4_cbp
[
48
]
=
{
47
,
31
,
15
,
0
,
23
,
27
,
29
,
30
,
7
,
11
,
13
,
14
,
39
,
43
,
45
,
46
,
16
,
3
,
5
,
10
,
12
,
19
,
21
,
26
,
28
,
35
,
37
,
42
,
44
,
1
,
2
,
4
,
8
,
17
,
18
,
20
,
24
,
6
,
9
,
22
,
25
,
32
,
33
,
34
,
36
,
40
,
38
,
41
};
const
uint8_t
ff_h264_golomb_to_inter_cbp
[
48
]
=
{
0
,
16
,
1
,
2
,
4
,
8
,
32
,
3
,
5
,
10
,
12
,
15
,
47
,
7
,
11
,
13
,
14
,
6
,
9
,
31
,
35
,
37
,
42
,
44
,
33
,
34
,
36
,
40
,
39
,
43
,
45
,
46
,
17
,
18
,
20
,
24
,
19
,
21
,
26
,
28
,
23
,
27
,
29
,
30
,
22
,
25
,
38
,
41
};
const
uint8_t
ff_h264_chroma_dc_scan
[
4
]
=
{
(
0
+
0
*
2
)
*
16
,
(
1
+
0
*
2
)
*
16
,
(
0
+
1
*
2
)
*
16
,
(
1
+
1
*
2
)
*
16
,
};
const
uint8_t
ff_h264_chroma422_dc_scan
[
8
]
=
{
(
0
+
0
*
2
)
*
16
,
(
0
+
1
*
2
)
*
16
,
(
1
+
0
*
2
)
*
16
,
(
0
+
2
*
2
)
*
16
,
(
0
+
3
*
2
)
*
16
,
(
1
+
1
*
2
)
*
16
,
(
1
+
2
*
2
)
*
16
,
(
1
+
3
*
2
)
*
16
,
};
const
IMbInfo
ff_h264_i_mb_type_info
[
26
]
=
{
{
MB_TYPE_INTRA4x4
,
-
1
,
-
1
},
{
MB_TYPE_INTRA16x16
,
2
,
0
},
{
MB_TYPE_INTRA16x16
,
1
,
0
},
{
MB_TYPE_INTRA16x16
,
0
,
0
},
{
MB_TYPE_INTRA16x16
,
3
,
0
},
{
MB_TYPE_INTRA16x16
,
2
,
16
},
{
MB_TYPE_INTRA16x16
,
1
,
16
},
{
MB_TYPE_INTRA16x16
,
0
,
16
},
{
MB_TYPE_INTRA16x16
,
3
,
16
},
{
MB_TYPE_INTRA16x16
,
2
,
32
},
{
MB_TYPE_INTRA16x16
,
1
,
32
},
{
MB_TYPE_INTRA16x16
,
0
,
32
},
{
MB_TYPE_INTRA16x16
,
3
,
32
},
{
MB_TYPE_INTRA16x16
,
2
,
15
+
0
},
{
MB_TYPE_INTRA16x16
,
1
,
15
+
0
},
{
MB_TYPE_INTRA16x16
,
0
,
15
+
0
},
{
MB_TYPE_INTRA16x16
,
3
,
15
+
0
},
{
MB_TYPE_INTRA16x16
,
2
,
15
+
16
},
{
MB_TYPE_INTRA16x16
,
1
,
15
+
16
},
{
MB_TYPE_INTRA16x16
,
0
,
15
+
16
},
{
MB_TYPE_INTRA16x16
,
3
,
15
+
16
},
{
MB_TYPE_INTRA16x16
,
2
,
15
+
32
},
{
MB_TYPE_INTRA16x16
,
1
,
15
+
32
},
{
MB_TYPE_INTRA16x16
,
0
,
15
+
32
},
{
MB_TYPE_INTRA16x16
,
3
,
15
+
32
},
{
MB_TYPE_INTRA_PCM
,
-
1
,
-
1
},
};
const
PMbInfo
ff_h264_p_mb_type_info
[
5
]
=
{
{
MB_TYPE_16x16
|
MB_TYPE_P0L0
,
1
},
{
MB_TYPE_16x8
|
MB_TYPE_P0L0
|
MB_TYPE_P1L0
,
2
},
{
MB_TYPE_8x16
|
MB_TYPE_P0L0
|
MB_TYPE_P1L0
,
2
},
{
MB_TYPE_8x8
|
MB_TYPE_P0L0
|
MB_TYPE_P1L0
,
4
},
{
MB_TYPE_8x8
|
MB_TYPE_P0L0
|
MB_TYPE_P1L0
|
MB_TYPE_REF0
,
4
},
};
const
PMbInfo
ff_h264_p_sub_mb_type_info
[
4
]
=
{
{
MB_TYPE_16x16
|
MB_TYPE_P0L0
,
1
},
{
MB_TYPE_16x8
|
MB_TYPE_P0L0
,
2
},
{
MB_TYPE_8x16
|
MB_TYPE_P0L0
,
2
},
{
MB_TYPE_8x8
|
MB_TYPE_P0L0
,
4
},
};
const
PMbInfo
ff_h264_b_mb_type_info
[
23
]
=
{
{
MB_TYPE_DIRECT2
|
MB_TYPE_L0L1
,
1
,
},
{
MB_TYPE_16x16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L1
,
4
,
},
};
libavcodec/h264data.h
View file @
a7da517f
/*
* H26L/H264/AVC/JVT/14496-10/... encoder/decoder
* Copyright (c) 2003 Michael Niedermayer <michaelni@gmx.at>
*
* This file is part of Libav.
*
* Libav is free software; you can redistribute it and/or
...
...
@@ -19,49 +16,19 @@
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*/
/**
* @file
* @brief
* H264 / AVC / MPEG4 part10 codec data table
* @author Michael Niedermayer <michaelni@gmx.at>
*/
#ifndef AVCODEC_H264DATA_H
#define AVCODEC_H264DATA_H
#include <stdint.h>
#include "libavutil/rational.h"
#include "h264.h"
static
const
uint8_t
golomb_to_pict_type
[
5
]
=
{
AV_PICTURE_TYPE_P
,
AV_PICTURE_TYPE_B
,
AV_PICTURE_TYPE_I
,
AV_PICTURE_TYPE_SP
,
AV_PICTURE_TYPE_SI
};
static
const
uint8_t
golomb_to_intra4x4_cbp
[
48
]
=
{
47
,
31
,
15
,
0
,
23
,
27
,
29
,
30
,
7
,
11
,
13
,
14
,
39
,
43
,
45
,
46
,
16
,
3
,
5
,
10
,
12
,
19
,
21
,
26
,
28
,
35
,
37
,
42
,
44
,
1
,
2
,
4
,
8
,
17
,
18
,
20
,
24
,
6
,
9
,
22
,
25
,
32
,
33
,
34
,
36
,
40
,
38
,
41
};
static
const
uint8_t
golomb_to_inter_cbp
[
48
]
=
{
0
,
16
,
1
,
2
,
4
,
8
,
32
,
3
,
5
,
10
,
12
,
15
,
47
,
7
,
11
,
13
,
14
,
6
,
9
,
31
,
35
,
37
,
42
,
44
,
33
,
34
,
36
,
40
,
39
,
43
,
45
,
46
,
17
,
18
,
20
,
24
,
19
,
21
,
26
,
28
,
23
,
27
,
29
,
30
,
22
,
25
,
38
,
41
};
extern
const
uint8_t
ff_h264_golomb_to_pict_type
[
5
];
extern
const
uint8_t
ff_h264_golomb_to_intra4x4_cbp
[
48
];
extern
const
uint8_t
ff_h264_golomb_to_inter_cbp
[
48
];
static
const
uint8_t
chroma_dc_scan
[
4
]
=
{
(
0
+
0
*
2
)
*
16
,
(
1
+
0
*
2
)
*
16
,
(
0
+
1
*
2
)
*
16
,
(
1
+
1
*
2
)
*
16
,
};
static
const
uint8_t
chroma422_dc_scan
[
8
]
=
{
(
0
+
0
*
2
)
*
16
,
(
0
+
1
*
2
)
*
16
,
(
1
+
0
*
2
)
*
16
,
(
0
+
2
*
2
)
*
16
,
(
0
+
3
*
2
)
*
16
,
(
1
+
1
*
2
)
*
16
,
(
1
+
2
*
2
)
*
16
,
(
1
+
3
*
2
)
*
16
,
};
extern
const
uint8_t
ff_h264_chroma_dc_scan
[
4
];
extern
const
uint8_t
ff_h264_chroma422_dc_scan
[
8
];
typedef
struct
IMbInfo
{
uint16_t
type
;
...
...
@@ -69,95 +36,16 @@ typedef struct IMbInfo {
uint8_t
cbp
;
}
IMbInfo
;
static
const
IMbInfo
i_mb_type_info
[
26
]
=
{
{
MB_TYPE_INTRA4x4
,
-
1
,
-
1
},
{
MB_TYPE_INTRA16x16
,
2
,
0
},
{
MB_TYPE_INTRA16x16
,
1
,
0
},
{
MB_TYPE_INTRA16x16
,
0
,
0
},
{
MB_TYPE_INTRA16x16
,
3
,
0
},
{
MB_TYPE_INTRA16x16
,
2
,
16
},
{
MB_TYPE_INTRA16x16
,
1
,
16
},
{
MB_TYPE_INTRA16x16
,
0
,
16
},
{
MB_TYPE_INTRA16x16
,
3
,
16
},
{
MB_TYPE_INTRA16x16
,
2
,
32
},
{
MB_TYPE_INTRA16x16
,
1
,
32
},
{
MB_TYPE_INTRA16x16
,
0
,
32
},
{
MB_TYPE_INTRA16x16
,
3
,
32
},
{
MB_TYPE_INTRA16x16
,
2
,
15
+
0
},
{
MB_TYPE_INTRA16x16
,
1
,
15
+
0
},
{
MB_TYPE_INTRA16x16
,
0
,
15
+
0
},
{
MB_TYPE_INTRA16x16
,
3
,
15
+
0
},
{
MB_TYPE_INTRA16x16
,
2
,
15
+
16
},
{
MB_TYPE_INTRA16x16
,
1
,
15
+
16
},
{
MB_TYPE_INTRA16x16
,
0
,
15
+
16
},
{
MB_TYPE_INTRA16x16
,
3
,
15
+
16
},
{
MB_TYPE_INTRA16x16
,
2
,
15
+
32
},
{
MB_TYPE_INTRA16x16
,
1
,
15
+
32
},
{
MB_TYPE_INTRA16x16
,
0
,
15
+
32
},
{
MB_TYPE_INTRA16x16
,
3
,
15
+
32
},
{
MB_TYPE_INTRA_PCM
,
-
1
,
-
1
},
};
extern
const
IMbInfo
ff_h264_i_mb_type_info
[
26
];
typedef
struct
PMbInfo
{
uint16_t
type
;
uint8_t
partition_count
;
}
PMbInfo
;
static
const
PMbInfo
p_mb_type_info
[
5
]
=
{
{
MB_TYPE_16x16
|
MB_TYPE_P0L0
,
1
},
{
MB_TYPE_16x8
|
MB_TYPE_P0L0
|
MB_TYPE_P1L0
,
2
},
{
MB_TYPE_8x16
|
MB_TYPE_P0L0
|
MB_TYPE_P1L0
,
2
},
{
MB_TYPE_8x8
|
MB_TYPE_P0L0
|
MB_TYPE_P1L0
,
4
},
{
MB_TYPE_8x8
|
MB_TYPE_P0L0
|
MB_TYPE_P1L0
|
MB_TYPE_REF0
,
4
},
};
static
const
PMbInfo
p_sub_mb_type_info
[
4
]
=
{
{
MB_TYPE_16x16
|
MB_TYPE_P0L0
,
1
},
{
MB_TYPE_16x8
|
MB_TYPE_P0L0
,
2
},
{
MB_TYPE_8x16
|
MB_TYPE_P0L0
,
2
},
{
MB_TYPE_8x8
|
MB_TYPE_P0L0
,
4
},
};
static
const
PMbInfo
b_mb_type_info
[
23
]
=
{
{
MB_TYPE_DIRECT2
|
MB_TYPE_L0L1
,
1
,
},
{
MB_TYPE_16x16
|
MB_TYPE_P0L0
,
1
,
},
{
MB_TYPE_16x16
|
MB_TYPE_P0L1
,
1
,
},
{
MB_TYPE_16x16
|
MB_TYPE_P0L0
|
MB_TYPE_P0L1
,
1
,
},
{
MB_TYPE_16x8
|
MB_TYPE_P0L0
|
MB_TYPE_P1L0
,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YPE_P0L1
|
MB_TYPE_P1L0
|
MB_TYPE_P1L1
,
2
,
},
{
MB_TYPE_8x8
|
MB_TYPE_P0L0
|
MB_TYPE_P0L1
|
MB_TYPE_P1L0
|
MB_TYPE_P1L1
,
4
,
},
};
static
const
PMbInfo
b_sub_mb_type_info
[
13
]
=
{
{
MB_TYPE_DIRECT2
,
1
,
},
{
MB_TYPE_16x16
|
MB_TYPE_P0L0
,
1
,
},
{
MB_TYPE_16x16
|
MB_TYPE_P0L1
,
1
,
},
{
MB_TYPE_16x16
|
MB_TYPE_P0L0
|
MB_TYPE_P0L1
,
1
,
},
{
MB_TYPE_16x8
|
MB_TYPE_P0L0
|
MB_TYPE_P1L0
,
2
,
},
{
MB_TYPE_8x16
|
MB_TYPE_P0L0
|
MB_TYPE_P1L0
,
2
,
},
{
MB_TYPE_16x8
|
MB_TYPE_P0L1
|
MB_TYPE_P1L1
,
2
,
},
{
MB_TYPE_8x16
|
MB_TYPE_P0L1
|
MB_TYPE_P1L1
,
2
,
},
{
MB_TYPE_16x8
|
MB_TYPE_P0L0
|
MB_TYPE_P0L1
|
MB_TYPE_P1L0
|
MB_TYPE_P1L1
,
2
,
},
{
MB_TYPE_8x16
|
MB_TYPE_P0L0
|
MB_TYPE_P0L1
|
MB_TYPE_P1L0
|
MB_TYPE_P1L1
,
2
,
},
{
MB_TYPE_8x8
|
MB_TYPE_P0L0
|
MB_TYPE_P1L0
,
4
,
},
{
MB_TYPE_8x8
|
MB_TYPE_P0L1
|
MB_TYPE_P1L1
,
4
,
},
{
MB_TYPE_8x8
|
MB_TYPE_P0L0
|
MB_TYPE_P0L1
|
MB_TYPE_P1L0
|
MB_TYPE_P1L1
,
4
,
},
};
extern
const
PMbInfo
ff_h264_p_mb_type_info
[
5
];
extern
const
PMbInfo
ff_h264_p_sub_mb_type_info
[
4
];
extern
const
PMbInfo
ff_h264_b_mb_type_info
[
23
];
extern
const
PMbInfo
ff_h264_b_sub_mb_type_info
[
13
];
#endif
/* AVCODEC_H264DATA_H */
libavcodec/svq3.c
View file @
a7da517f
...
...
@@ -47,10 +47,8 @@
#include "avcodec.h"
#include "mpegutils.h"
#include "h264.h"
#include "h264data.h" // FIXME FIXME FIXME
#include "h264_mvpred.h"
#include "h264data.h"
#include "golomb.h"
#include "hpeldsp.h"
#include "mathops.h"
...
...
@@ -241,7 +239,7 @@ static inline int svq3_decode_block(GetBitContext *gb, int16_t *block,
int
index
,
const
int
type
)
{
static
const
uint8_t
*
const
scan_patterns
[
4
]
=
{
luma_dc_zigzag_scan
,
ff_zigzag_scan
,
svq3_scan
,
chroma_dc_scan
luma_dc_zigzag_scan
,
ff_zigzag_scan
,
svq3_scan
,
ff_h264_
chroma_dc_scan
};
int
run
,
level
,
limit
;
...
...
@@ -663,7 +661,7 @@ static int svq3_decode_mb(SVQ3Context *s, unsigned int mb_type)
mb_type
=
MB_TYPE_INTRA4x4
;
}
else
{
/* INTRA16x16 */
dir
=
i_mb_type_info
[
mb_type
-
8
].
pred_mode
;
dir
=
ff_h264_
i_mb_type_info
[
mb_type
-
8
].
pred_mode
;
dir
=
(
dir
>>
1
)
^
3
*
(
dir
&
1
)
^
1
;
if
((
sl
->
intra16x16_pred_mode
=
ff_h264_check_intra_pred_mode
(
h
,
sl
,
dir
,
0
))
<
0
)
{
...
...
@@ -671,7 +669,7 @@ static int svq3_decode_mb(SVQ3Context *s, unsigned int mb_type)
return
sl
->
intra16x16_pred_mode
;
}
cbp
=
i_mb_type_info
[
mb_type
-
8
].
cbp
;
cbp
=
ff_h264_
i_mb_type_info
[
mb_type
-
8
].
cbp
;
mb_type
=
MB_TYPE_INTRA16x16
;
}
...
...
@@ -699,8 +697,8 @@ static int svq3_decode_mb(SVQ3Context *s, unsigned int mb_type)
return
-
1
;
}
cbp
=
IS_INTRA
(
mb_type
)
?
golomb_to_intra4x4_cbp
[
vlc
]
:
golomb_to_inter_cbp
[
vlc
];
cbp
=
IS_INTRA
(
mb_type
)
?
ff_h264_
golomb_to_intra4x4_cbp
[
vlc
]
:
ff_h264_
golomb_to_inter_cbp
[
vlc
];
}
if
(
IS_INTRA16x16
(
mb_type
)
||
(
h
->
pict_type
!=
AV_PICTURE_TYPE_I
&&
s
->
adaptive_quant
&&
cbp
))
{
...
...
@@ -828,7 +826,7 @@ static int svq3_decode_slice_header(AVCodecContext *avctx)
return
-
1
;
}
sl
->
slice_type
=
golomb_to_pict_type
[
slice_id
];
sl
->
slice_type
=
ff_h264_
golomb_to_pict_type
[
slice_id
];
if
((
header
&
0x9F
)
==
2
)
{
i
=
(
h
->
mb_num
<
64
)
?
6
:
(
1
+
av_log2
(
h
->
mb_num
-
1
));
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment