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
8b00f4df
Commit
8b00f4df
authored
Jan 17, 2015
by
Anton Khirnov
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
h264: move some neighbour information into the per-slice context
parent
4bd5ac20
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
9 changed files
with
156 additions
and
144 deletions
+156
-144
h264.h
libavcodec/h264.h
+13
-13
h264_cabac.c
libavcodec/h264_cabac.c
+25
-22
h264_cavlc.c
libavcodec/h264_cavlc.c
+6
-6
h264_loopfilter.c
libavcodec/h264_loopfilter.c
+15
-14
h264_mb.c
libavcodec/h264_mb.c
+3
-2
h264_mb_template.c
libavcodec/h264_mb_template.c
+4
-4
h264_mvpred.h
libavcodec/h264_mvpred.h
+82
-76
h264_slice.c
libavcodec/h264_slice.c
+6
-6
svq3.c
libavcodec/svq3.c
+2
-1
No files found.
libavcodec/h264.h
View file @
8b00f4df
...
...
@@ -320,6 +320,19 @@ typedef struct H264SliceContext {
int
chroma_pred_mode
;
int
intra16x16_pred_mode
;
int
topleft_mb_xy
;
int
top_mb_xy
;
int
topright_mb_xy
;
int
left_mb_xy
[
LEFT_MBS
];
int
topleft_type
;
int
top_type
;
int
topright_type
;
int
left_type
[
LEFT_MBS
];
const
uint8_t
*
left_block
;
int
topleft_partition
;
}
H264SliceContext
;
/**
...
...
@@ -357,19 +370,6 @@ typedef struct H264Context {
int
workaround_bugs
;
// prediction stuff
int
topleft_mb_xy
;
int
top_mb_xy
;
int
topright_mb_xy
;
int
left_mb_xy
[
LEFT_MBS
];
int
topleft_type
;
int
top_type
;
int
topright_type
;
int
left_type
[
LEFT_MBS
];
const
uint8_t
*
left_block
;
int
topleft_partition
;
int8_t
intra4x4_pred_mode_cache
[
5
*
8
];
int8_t
(
*
intra4x4_pred_mode
);
H264PredContext
hpc
;
...
...
libavcodec/h264_cabac.c
View file @
8b00f4df
...
...
@@ -1293,15 +1293,17 @@ static int decode_cabac_field_decoding_flag(H264Context *h) {
return
get_cabac_noinline
(
&
h
->
cabac
,
&
(
h
->
cabac_state
+
70
)[
ctx
]
);
}
static
int
decode_cabac_intra_mb_type
(
H264Context
*
h
,
int
ctx_base
,
int
intra_slice
)
{
static
int
decode_cabac_intra_mb_type
(
H264Context
*
h
,
H264SliceContext
*
sl
,
int
ctx_base
,
int
intra_slice
)
{
uint8_t
*
state
=
&
h
->
cabac_state
[
ctx_base
];
int
mb_type
;
if
(
intra_slice
){
int
ctx
=
0
;
if
(
h
->
left_type
[
LTOP
]
&
(
MB_TYPE_INTRA16x16
|
MB_TYPE_INTRA_PCM
))
if
(
sl
->
left_type
[
LTOP
]
&
(
MB_TYPE_INTRA16x16
|
MB_TYPE_INTRA_PCM
))
ctx
++
;
if
(
h
->
top_type
&
(
MB_TYPE_INTRA16x16
|
MB_TYPE_INTRA_PCM
))
if
(
sl
->
top_type
&
(
MB_TYPE_INTRA16x16
|
MB_TYPE_INTRA_PCM
))
ctx
++
;
if
(
get_cabac_noinline
(
&
h
->
cabac
,
&
state
[
ctx
]
)
==
0
)
return
0
;
/* I4x4 */
...
...
@@ -1371,17 +1373,18 @@ static int decode_cabac_mb_intra4x4_pred_mode( H264Context *h, int pred_mode ) {
return
mode
+
(
mode
>=
pred_mode
);
}
static
int
decode_cabac_mb_chroma_pre_mode
(
H264Context
*
h
)
{
const
int
mba_xy
=
h
->
left_mb_xy
[
0
];
const
int
mbb_xy
=
h
->
top_mb_xy
;
static
int
decode_cabac_mb_chroma_pre_mode
(
H264Context
*
h
,
H264SliceContext
*
sl
)
{
const
int
mba_xy
=
sl
->
left_mb_xy
[
0
];
const
int
mbb_xy
=
sl
->
top_mb_xy
;
int
ctx
=
0
;
/* No need to test for IS_INTRA4x4 and IS_INTRA16x16, as we set chroma_pred_mode_table to 0 */
if
(
h
->
left_type
[
LTOP
]
&&
h
->
chroma_pred_mode_table
[
mba_xy
]
!=
0
)
if
(
sl
->
left_type
[
LTOP
]
&&
h
->
chroma_pred_mode_table
[
mba_xy
]
!=
0
)
ctx
++
;
if
(
h
->
top_type
&&
h
->
chroma_pred_mode_table
[
mbb_xy
]
!=
0
)
if
(
sl
->
top_type
&&
h
->
chroma_pred_mode_table
[
mbb_xy
]
!=
0
)
ctx
++
;
if
(
get_cabac_noinline
(
&
h
->
cabac
,
&
h
->
cabac_state
[
64
+
ctx
]
)
==
0
)
...
...
@@ -1928,15 +1931,15 @@ int ff_h264_decode_mb_cabac(H264Context *h, H264SliceContext *sl)
sl
->
prev_mb_skipped
=
0
;
fill_decode_neighbors
(
h
,
-
(
MB_FIELD
(
h
)));
fill_decode_neighbors
(
h
,
sl
,
-
(
MB_FIELD
(
h
)));
if
(
h
->
slice_type_nos
==
AV_PICTURE_TYPE_B
)
{
int
ctx
=
0
;
assert
(
h
->
slice_type_nos
==
AV_PICTURE_TYPE_B
);
if
(
!
IS_DIRECT
(
h
->
left_type
[
LTOP
]
-
1
)
)
if
(
!
IS_DIRECT
(
sl
->
left_type
[
LTOP
]
-
1
)
)
ctx
++
;
if
(
!
IS_DIRECT
(
h
->
top_type
-
1
)
)
if
(
!
IS_DIRECT
(
sl
->
top_type
-
1
)
)
ctx
++
;
if
(
!
get_cabac_noinline
(
&
h
->
cabac
,
&
h
->
cabac_state
[
27
+
ctx
]
)
){
...
...
@@ -1952,7 +1955,7 @@ int ff_h264_decode_mb_cabac(H264Context *h, H264SliceContext *sl)
if
(
bits
<
8
){
mb_type
=
bits
+
3
;
/* B_Bi_16x16 through B_L1_L0_16x8 */
}
else
if
(
bits
==
13
){
mb_type
=
decode_cabac_intra_mb_type
(
h
,
32
,
0
);
mb_type
=
decode_cabac_intra_mb_type
(
h
,
sl
,
32
,
0
);
goto
decode_intra_mb
;
}
else
if
(
bits
==
14
){
mb_type
=
11
;
/* B_L1_L0_8x16 */
...
...
@@ -1978,11 +1981,11 @@ int ff_h264_decode_mb_cabac(H264Context *h, H264SliceContext *sl)
partition_count
=
p_mb_type_info
[
mb_type
].
partition_count
;
mb_type
=
p_mb_type_info
[
mb_type
].
type
;
}
else
{
mb_type
=
decode_cabac_intra_mb_type
(
h
,
17
,
0
);
mb_type
=
decode_cabac_intra_mb_type
(
h
,
sl
,
17
,
0
);
goto
decode_intra_mb
;
}
}
else
{
mb_type
=
decode_cabac_intra_mb_type
(
h
,
3
,
1
);
mb_type
=
decode_cabac_intra_mb_type
(
h
,
sl
,
3
,
1
);
if
(
h
->
slice_type
==
AV_PICTURE_TYPE_SI
&&
mb_type
)
mb_type
--
;
assert
(
h
->
slice_type_nos
==
AV_PICTURE_TYPE_I
);
...
...
@@ -2031,7 +2034,7 @@ decode_intra_mb:
return
0
;
}
fill_decode_caches
(
h
,
mb_type
);
fill_decode_caches
(
h
,
sl
,
mb_type
);
if
(
IS_INTRA
(
mb_type
)
)
{
int
i
,
pred_mode
;
...
...
@@ -2060,7 +2063,7 @@ decode_intra_mb:
}
if
(
decode_chroma
){
h
->
chroma_pred_mode_table
[
mb_xy
]
=
pred_mode
=
decode_cabac_mb_chroma_pre_mode
(
h
);
pred_mode
=
decode_cabac_mb_chroma_pre_mode
(
h
,
sl
);
pred_mode
=
ff_h264_check_intra_pred_mode
(
h
,
pred_mode
,
1
);
if
(
pred_mode
<
0
)
return
-
1
;
...
...
@@ -2136,7 +2139,7 @@ decode_intra_mb:
const
int
index
=
4
*
i
+
block_width
*
j
;
int16_t
(
*
mv_cache
)[
2
]
=
&
h
->
mv_cache
[
list
][
scan8
[
index
]
];
uint8_t
(
*
mvd_cache
)[
2
]
=
&
h
->
mvd_cache
[
list
][
scan8
[
index
]
];
pred_motion
(
h
,
index
,
block_width
,
list
,
h
->
ref_cache
[
list
][
scan8
[
index
]
],
&
mx
,
&
my
);
pred_motion
(
h
,
sl
,
index
,
block_width
,
list
,
h
->
ref_cache
[
list
][
scan8
[
index
]
],
&
mx
,
&
my
);
DECODE_CABAC_MB_MVD
(
h
,
list
,
index
)
tprintf
(
h
->
avctx
,
"final mv:%d %d
\n
"
,
mx
,
my
);
...
...
@@ -2200,7 +2203,7 @@ decode_intra_mb:
for
(
list
=
0
;
list
<
h
->
list_count
;
list
++
){
if
(
IS_DIR
(
mb_type
,
0
,
list
)){
int
mx
,
my
,
mpx
,
mpy
;
pred_motion
(
h
,
0
,
4
,
list
,
h
->
ref_cache
[
list
][
scan8
[
0
]
],
&
mx
,
&
my
);
pred_motion
(
h
,
sl
,
0
,
4
,
list
,
h
->
ref_cache
[
list
][
scan8
[
0
]
],
&
mx
,
&
my
);
DECODE_CABAC_MB_MVD
(
h
,
list
,
0
)
tprintf
(
h
->
avctx
,
"final mv:%d %d
\n
"
,
mx
,
my
);
...
...
@@ -2231,7 +2234,7 @@ decode_intra_mb:
for
(
i
=
0
;
i
<
2
;
i
++
){
if
(
IS_DIR
(
mb_type
,
i
,
list
)){
int
mx
,
my
,
mpx
,
mpy
;
pred_16x8_motion
(
h
,
8
*
i
,
list
,
h
->
ref_cache
[
list
][
scan8
[
0
]
+
16
*
i
],
&
mx
,
&
my
);
pred_16x8_motion
(
h
,
sl
,
8
*
i
,
list
,
h
->
ref_cache
[
list
][
scan8
[
0
]
+
16
*
i
],
&
mx
,
&
my
);
DECODE_CABAC_MB_MVD
(
h
,
list
,
8
*
i
)
tprintf
(
h
->
avctx
,
"final mv:%d %d
\n
"
,
mx
,
my
);
...
...
@@ -2266,7 +2269,7 @@ decode_intra_mb:
for
(
i
=
0
;
i
<
2
;
i
++
){
if
(
IS_DIR
(
mb_type
,
i
,
list
)){
int
mx
,
my
,
mpx
,
mpy
;
pred_8x16_motion
(
h
,
i
*
4
,
list
,
h
->
ref_cache
[
list
][
scan8
[
0
]
+
2
*
i
],
&
mx
,
&
my
);
pred_8x16_motion
(
h
,
sl
,
i
*
4
,
list
,
h
->
ref_cache
[
list
][
scan8
[
0
]
+
2
*
i
],
&
mx
,
&
my
);
DECODE_CABAC_MB_MVD
(
h
,
list
,
4
*
i
)
tprintf
(
h
->
avctx
,
"final mv:%d %d
\n
"
,
mx
,
my
);
...
...
@@ -2304,7 +2307,7 @@ decode_intra_mb:
int
i
;
uint8_t
*
nnz_cache
=
h
->
non_zero_count_cache
;
for
(
i
=
0
;
i
<
2
;
i
++
){
if
(
h
->
left_type
[
LEFT
(
i
)]
&&
!
IS_8x8DCT
(
h
->
left_type
[
LEFT
(
i
)]))
{
if
(
sl
->
left_type
[
LEFT
(
i
)]
&&
!
IS_8x8DCT
(
sl
->
left_type
[
LEFT
(
i
)]))
{
nnz_cache
[
3
+
8
*
1
+
2
*
8
*
i
]
=
nnz_cache
[
3
+
8
*
2
+
2
*
8
*
i
]
=
nnz_cache
[
3
+
8
*
6
+
2
*
8
*
i
]
=
...
...
@@ -2313,7 +2316,7 @@ decode_intra_mb:
nnz_cache
[
3
+
8
*
12
+
2
*
8
*
i
]
=
IS_INTRA
(
mb_type
)
?
64
:
0
;
}
}
if
(
h
->
top_type
&&
!
IS_8x8DCT
(
h
->
top_type
)){
if
(
sl
->
top_type
&&
!
IS_8x8DCT
(
sl
->
top_type
)){
uint32_t
top_empty
=
CABAC
(
h
)
&&
!
IS_INTRA
(
mb_type
)
?
0
:
0x40404040
;
AV_WN32A
(
&
nnz_cache
[
4
+
8
*
0
],
top_empty
);
AV_WN32A
(
&
nnz_cache
[
4
+
8
*
5
],
top_empty
);
...
...
libavcodec/h264_cavlc.c
View file @
8b00f4df
...
...
@@ -781,8 +781,8 @@ decode_intra_mb:
return
0
;
}
fill_decode_neighbors
(
h
,
mb_type
);
fill_decode_caches
(
h
,
mb_type
);
fill_decode_neighbors
(
h
,
sl
,
mb_type
);
fill_decode_caches
(
h
,
sl
,
mb_type
);
//mb_pred
if
(
IS_INTRA
(
mb_type
)){
...
...
@@ -903,7 +903,7 @@ decode_intra_mb:
int
mx
,
my
;
const
int
index
=
4
*
i
+
block_width
*
j
;
int16_t
(
*
mv_cache
)[
2
]
=
&
h
->
mv_cache
[
list
][
scan8
[
index
]
];
pred_motion
(
h
,
index
,
block_width
,
list
,
h
->
ref_cache
[
list
][
scan8
[
index
]
],
&
mx
,
&
my
);
pred_motion
(
h
,
sl
,
index
,
block_width
,
list
,
h
->
ref_cache
[
list
][
scan8
[
index
]
],
&
mx
,
&
my
);
mx
+=
get_se_golomb
(
&
h
->
gb
);
my
+=
get_se_golomb
(
&
h
->
gb
);
tprintf
(
h
->
avctx
,
"final mv:%d %d
\n
"
,
mx
,
my
);
...
...
@@ -957,7 +957,7 @@ decode_intra_mb:
}
for
(
list
=
0
;
list
<
h
->
list_count
;
list
++
){
if
(
IS_DIR
(
mb_type
,
0
,
list
)){
pred_motion
(
h
,
0
,
4
,
list
,
h
->
ref_cache
[
list
][
scan8
[
0
]
],
&
mx
,
&
my
);
pred_motion
(
h
,
sl
,
0
,
4
,
list
,
h
->
ref_cache
[
list
][
scan8
[
0
]
],
&
mx
,
&
my
);
mx
+=
get_se_golomb
(
&
h
->
gb
);
my
+=
get_se_golomb
(
&
h
->
gb
);
tprintf
(
h
->
avctx
,
"final mv:%d %d
\n
"
,
mx
,
my
);
...
...
@@ -992,7 +992,7 @@ decode_intra_mb:
for
(
i
=
0
;
i
<
2
;
i
++
){
unsigned
int
val
;
if
(
IS_DIR
(
mb_type
,
i
,
list
)){
pred_16x8_motion
(
h
,
8
*
i
,
list
,
h
->
ref_cache
[
list
][
scan8
[
0
]
+
16
*
i
],
&
mx
,
&
my
);
pred_16x8_motion
(
h
,
sl
,
8
*
i
,
list
,
h
->
ref_cache
[
list
][
scan8
[
0
]
+
16
*
i
],
&
mx
,
&
my
);
mx
+=
get_se_golomb
(
&
h
->
gb
);
my
+=
get_se_golomb
(
&
h
->
gb
);
tprintf
(
h
->
avctx
,
"final mv:%d %d
\n
"
,
mx
,
my
);
...
...
@@ -1030,7 +1030,7 @@ decode_intra_mb:
for
(
i
=
0
;
i
<
2
;
i
++
){
unsigned
int
val
;
if
(
IS_DIR
(
mb_type
,
i
,
list
)){
pred_8x16_motion
(
h
,
i
*
4
,
list
,
h
->
ref_cache
[
list
][
scan8
[
0
]
+
2
*
i
],
&
mx
,
&
my
);
pred_8x16_motion
(
h
,
sl
,
i
*
4
,
list
,
h
->
ref_cache
[
list
][
scan8
[
0
]
+
2
*
i
],
&
mx
,
&
my
);
mx
+=
get_se_golomb
(
&
h
->
gb
);
my
+=
get_se_golomb
(
&
h
->
gb
);
tprintf
(
h
->
avctx
,
"final mv:%d %d
\n
"
,
mx
,
my
);
...
...
libavcodec/h264_loopfilter.c
View file @
8b00f4df
...
...
@@ -235,6 +235,7 @@ static av_always_inline void filter_mb_edgech(uint8_t *pix, int stride,
}
static
av_always_inline
void
h264_filter_mb_fast_internal
(
H264Context
*
h
,
H264SliceContext
*
sl
,
int
mb_x
,
int
mb_y
,
uint8_t
*
img_y
,
uint8_t
*
img_cb
,
...
...
@@ -248,8 +249,8 @@ static av_always_inline void h264_filter_mb_fast_internal(H264Context *h,
int
chroma422
=
CHROMA422
(
h
);
int
mb_xy
=
h
->
mb_xy
;
int
left_type
=
h
->
left_type
[
LTOP
];
int
top_type
=
h
->
top_type
;
int
left_type
=
sl
->
left_type
[
LTOP
];
int
top_type
=
sl
->
top_type
;
int
qp_bd_offset
=
6
*
(
h
->
sps
.
bit_depth_luma
-
8
);
int
a
=
52
+
h
->
slice_alpha_c0_offset
-
qp_bd_offset
;
...
...
@@ -258,7 +259,7 @@ static av_always_inline void h264_filter_mb_fast_internal(H264Context *h,
int
mb_type
=
h
->
cur_pic
.
mb_type
[
mb_xy
];
int
qp
=
h
->
cur_pic
.
qscale_table
[
mb_xy
];
int
qp0
=
h
->
cur_pic
.
qscale_table
[
mb_xy
-
1
];
int
qp1
=
h
->
cur_pic
.
qscale_table
[
h
->
top_mb_xy
];
int
qp1
=
h
->
cur_pic
.
qscale_table
[
sl
->
top_mb_xy
];
int
qpc
=
get_chroma_qp
(
h
,
0
,
qp
);
int
qpc0
=
get_chroma_qp
(
h
,
0
,
qp0
);
int
qpc1
=
get_chroma_qp
(
h
,
0
,
qp1
);
...
...
@@ -427,12 +428,12 @@ void ff_h264_filter_mb_fast(H264Context *h, H264SliceContext *sl,
}
#if CONFIG_SMALL
h264_filter_mb_fast_internal
(
h
,
mb_x
,
mb_y
,
img_y
,
img_cb
,
img_cr
,
linesize
,
uvlinesize
,
h
->
pixel_shift
);
h264_filter_mb_fast_internal
(
h
,
sl
,
mb_x
,
mb_y
,
img_y
,
img_cb
,
img_cr
,
linesize
,
uvlinesize
,
h
->
pixel_shift
);
#else
if
(
h
->
pixel_shift
){
h264_filter_mb_fast_internal
(
h
,
mb_x
,
mb_y
,
img_y
,
img_cb
,
img_cr
,
linesize
,
uvlinesize
,
1
);
h264_filter_mb_fast_internal
(
h
,
sl
,
mb_x
,
mb_y
,
img_y
,
img_cb
,
img_cr
,
linesize
,
uvlinesize
,
1
);
}
else
{
h264_filter_mb_fast_internal
(
h
,
mb_x
,
mb_y
,
img_y
,
img_cb
,
img_cr
,
linesize
,
uvlinesize
,
0
);
h264_filter_mb_fast_internal
(
h
,
sl
,
mb_x
,
mb_y
,
img_y
,
img_cb
,
img_cr
,
linesize
,
uvlinesize
,
0
);
}
#endif
}
...
...
@@ -478,8 +479,8 @@ static av_always_inline void filter_mb_dir(H264Context *h, H264SliceContext *sl,
int
chroma_qp_avg
[
2
];
int
chroma444
=
CHROMA444
(
h
);
int
chroma422
=
CHROMA422
(
h
);
const
int
mbm_xy
=
dir
==
0
?
mb_xy
-
1
:
h
->
top_mb_xy
;
const
int
mbm_type
=
dir
==
0
?
h
->
left_type
[
LTOP
]
:
h
->
top_type
;
const
int
mbm_xy
=
dir
==
0
?
mb_xy
-
1
:
sl
->
top_mb_xy
;
const
int
mbm_type
=
dir
==
0
?
sl
->
left_type
[
LTOP
]
:
sl
->
top_type
;
// how often to recheck mv-based bS when iterating between edges
static
const
uint8_t
mask_edge_tab
[
2
][
8
]
=
{{
0
,
3
,
3
,
3
,
1
,
1
,
1
,
1
},
...
...
@@ -726,9 +727,9 @@ void ff_h264_filter_mb(H264Context *h, H264SliceContext *sl,
if
(
FRAME_MBAFF
(
h
)
// and current and left pair do not have the same interlaced type
&&
IS_INTERLACED
(
mb_type
^
h
->
left_type
[
LTOP
])
&&
IS_INTERLACED
(
mb_type
^
sl
->
left_type
[
LTOP
])
// and left mb is in available to us
&&
h
->
left_type
[
LTOP
])
{
&&
sl
->
left_type
[
LTOP
])
{
/* First vertical edge is different in MBAFF frames
* There are 8 different bS to compute and 2 different Qp
*/
...
...
@@ -756,8 +757,8 @@ void ff_h264_filter_mb(H264Context *h, H264SliceContext *sl,
const
uint8_t
*
off
=
offset
[
MB_FIELD
(
h
)][
mb_y
&
1
];
for
(
i
=
0
;
i
<
8
;
i
++
)
{
int
j
=
MB_FIELD
(
h
)
?
i
>>
2
:
i
&
1
;
int
mbn_xy
=
h
->
left_mb_xy
[
LEFT
(
j
)];
int
mbn_type
=
h
->
left_type
[
LEFT
(
j
)];
int
mbn_xy
=
sl
->
left_mb_xy
[
LEFT
(
j
)];
int
mbn_type
=
sl
->
left_type
[
LEFT
(
j
)];
if
(
IS_INTRA
(
mbn_type
)
)
bS
[
i
]
=
4
;
...
...
@@ -772,8 +773,8 @@ void ff_h264_filter_mb(H264Context *h, H264SliceContext *sl,
}
mb_qp
=
h
->
cur_pic
.
qscale_table
[
mb_xy
];
mbn0_qp
=
h
->
cur_pic
.
qscale_table
[
h
->
left_mb_xy
[
0
]];
mbn1_qp
=
h
->
cur_pic
.
qscale_table
[
h
->
left_mb_xy
[
1
]];
mbn0_qp
=
h
->
cur_pic
.
qscale_table
[
sl
->
left_mb_xy
[
0
]];
mbn1_qp
=
h
->
cur_pic
.
qscale_table
[
sl
->
left_mb_xy
[
1
]];
qp
[
0
]
=
(
mb_qp
+
mbn0_qp
+
1
)
>>
1
;
bqp
[
0
]
=
(
get_chroma_qp
(
h
,
0
,
mb_qp
)
+
get_chroma_qp
(
h
,
0
,
mbn0_qp
)
+
1
)
>>
1
;
...
...
libavcodec/h264_mb.c
View file @
8b00f4df
...
...
@@ -496,7 +496,8 @@ static av_always_inline void prefetch_motion(H264Context *h, int list,
}
}
static
av_always_inline
void
xchg_mb_border
(
H264Context
*
h
,
uint8_t
*
src_y
,
static
av_always_inline
void
xchg_mb_border
(
H264Context
*
h
,
H264SliceContext
*
sl
,
uint8_t
*
src_y
,
uint8_t
*
src_cb
,
uint8_t
*
src_cr
,
int
linesize
,
int
uvlinesize
,
int
xchg
,
int
chroma444
,
...
...
@@ -519,7 +520,7 @@ static av_always_inline void xchg_mb_border(H264Context *h, uint8_t *src_y,
if
(
h
->
deblocking_filter
==
2
)
{
deblock_topleft
=
h
->
slice_table
[
h
->
mb_xy
-
1
-
h
->
mb_stride
]
==
h
->
slice_num
;
deblock_top
=
h
->
top_type
;
deblock_top
=
sl
->
top_type
;
}
else
{
deblock_topleft
=
(
h
->
mb_x
>
0
);
deblock_top
=
(
h
->
mb_y
>
!!
MB_FIELD
(
h
));
...
...
libavcodec/h264_mb_template.c
View file @
8b00f4df
...
...
@@ -159,7 +159,7 @@ static av_noinline void FUNC(hl_decode_mb)(H264Context *h, H264SliceContext *sl)
}
else
{
if
(
IS_INTRA
(
mb_type
))
{
if
(
h
->
deblocking_filter
)
xchg_mb_border
(
h
,
dest_y
,
dest_cb
,
dest_cr
,
linesize
,
xchg_mb_border
(
h
,
sl
,
dest_y
,
dest_cb
,
dest_cr
,
linesize
,
uvlinesize
,
1
,
0
,
SIMPLE
,
PIXEL_SHIFT
);
if
(
SIMPLE
||
!
CONFIG_GRAY
||
!
(
h
->
flags
&
CODEC_FLAG_GRAY
))
{
...
...
@@ -172,7 +172,7 @@ static av_noinline void FUNC(hl_decode_mb)(H264Context *h, H264SliceContext *sl)
block_offset
,
linesize
,
dest_y
,
0
);
if
(
h
->
deblocking_filter
)
xchg_mb_border
(
h
,
dest_y
,
dest_cb
,
dest_cr
,
linesize
,
xchg_mb_border
(
h
,
sl
,
dest_y
,
dest_cb
,
dest_cr
,
linesize
,
uvlinesize
,
0
,
0
,
SIMPLE
,
PIXEL_SHIFT
);
}
else
if
(
is_h264
)
{
if
(
chroma422
)
{
...
...
@@ -343,7 +343,7 @@ static av_noinline void FUNC(hl_decode_mb_444)(H264Context *h, H264SliceContext
}
else
{
if
(
IS_INTRA
(
mb_type
))
{
if
(
h
->
deblocking_filter
)
xchg_mb_border
(
h
,
dest
[
0
],
dest
[
1
],
dest
[
2
],
linesize
,
xchg_mb_border
(
h
,
sl
,
dest
[
0
],
dest
[
1
],
dest
[
2
],
linesize
,
linesize
,
1
,
1
,
SIMPLE
,
PIXEL_SHIFT
);
for
(
p
=
0
;
p
<
plane_count
;
p
++
)
...
...
@@ -352,7 +352,7 @@ static av_noinline void FUNC(hl_decode_mb_444)(H264Context *h, H264SliceContext
block_offset
,
linesize
,
dest
[
p
],
p
);
if
(
h
->
deblocking_filter
)
xchg_mb_border
(
h
,
dest
[
0
],
dest
[
1
],
dest
[
2
],
linesize
,
xchg_mb_border
(
h
,
sl
,
dest
[
0
],
dest
[
1
],
dest
[
2
],
linesize
,
linesize
,
0
,
1
,
SIMPLE
,
PIXEL_SHIFT
);
}
else
{
FUNC
(
hl_motion_444
)(
h
,
sl
,
dest
[
0
],
dest
[
1
],
dest
[
2
],
...
...
libavcodec/h264_mvpred.h
View file @
8b00f4df
This diff is collapsed.
Click to expand it.
libavcodec/h264_slice.c
View file @
8b00f4df
...
...
@@ -1932,9 +1932,9 @@ static int fill_filter_caches(H264Context *h, H264SliceContext *sl, int mb_type)
}
}
h
->
top_mb_xy
=
top_xy
;
h
->
left_mb_xy
[
LTOP
]
=
left_xy
[
LTOP
];
h
->
left_mb_xy
[
LBOT
]
=
left_xy
[
LBOT
];
sl
->
top_mb_xy
=
top_xy
;
sl
->
left_mb_xy
[
LTOP
]
=
left_xy
[
LTOP
];
sl
->
left_mb_xy
[
LBOT
]
=
left_xy
[
LBOT
];
{
/* For sufficiently low qp, filtering wouldn't do anything.
* This is a conservative estimate: could also check beta_offset
...
...
@@ -1970,9 +1970,9 @@ static int fill_filter_caches(H264Context *h, H264SliceContext *sl, int mb_type)
if
(
h
->
slice_table
[
left_xy
[
LBOT
]]
==
0xFFFF
)
left_type
[
LTOP
]
=
left_type
[
LBOT
]
=
0
;
}
h
->
top_type
=
top_type
;
h
->
left_type
[
LTOP
]
=
left_type
[
LTOP
];
h
->
left_type
[
LBOT
]
=
left_type
[
LBOT
];
sl
->
top_type
=
top_type
;
sl
->
left_type
[
LTOP
]
=
left_type
[
LTOP
];
sl
->
left_type
[
LBOT
]
=
left_type
[
LBOT
];
if
(
IS_INTRA
(
mb_type
))
return
0
;
...
...
libavcodec/svq3.c
View file @
8b00f4df
...
...
@@ -369,6 +369,7 @@ static inline int svq3_mc_dir(SVQ3Context *s, int size, int mode,
{
int
i
,
j
,
k
,
mx
,
my
,
dx
,
dy
,
x
,
y
;
H264Context
*
h
=
&
s
->
h
;
H264SliceContext
*
sl
=
&
h
->
slice_ctx
[
0
];
const
int
part_width
=
((
size
&
5
)
==
4
)
?
4
:
16
>>
(
size
&
1
);
const
int
part_height
=
16
>>
((
unsigned
)(
size
+
1
)
/
3
);
const
int
extra_width
=
(
mode
==
PREDICT_MODE
)
?
-
16
*
6
:
0
;
...
...
@@ -386,7 +387,7 @@ static inline int svq3_mc_dir(SVQ3Context *s, int size, int mode,
(
j
>>
1
&
4
)
+
(
i
&
8
);
if
(
mode
!=
PREDICT_MODE
)
{
pred_motion
(
h
,
k
,
part_width
>>
2
,
dir
,
1
,
&
mx
,
&
my
);
pred_motion
(
h
,
sl
,
k
,
part_width
>>
2
,
dir
,
1
,
&
mx
,
&
my
);
}
else
{
mx
=
s
->
next_pic
->
motion_val
[
0
][
b_xy
][
0
]
<<
1
;
my
=
s
->
next_pic
->
motion_val
[
0
][
b_xy
][
1
]
<<
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