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
f69574cf
Commit
f69574cf
authored
Jan 17, 2015
by
Anton Khirnov
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
h264: move non_zero_count_cache into the per-slice context
parent
64c81b2c
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
10 changed files
with
124 additions
and
107 deletions
+124
-107
h264.c
libavcodec/h264.c
+2
-1
h264.h
libavcodec/h264.h
+9
-8
h264_cabac.c
libavcodec/h264_cabac.c
+50
-40
h264_cavlc.c
libavcodec/h264_cavlc.c
+32
-27
h264_loopfilter.c
libavcodec/h264_loopfilter.c
+11
-11
h264_mb.c
libavcodec/h264_mb.c
+9
-9
h264_mb_template.c
libavcodec/h264_mb_template.c
+6
-6
h264_mvpred.h
libavcodec/h264_mvpred.h
+1
-1
h264_slice.c
libavcodec/h264_slice.c
+1
-1
svq3.c
libavcodec/svq3.c
+3
-3
No files found.
libavcodec/h264.c
View file @
f69574cf
...
...
@@ -56,11 +56,12 @@ static void h264_er_decode_mb(void *opaque, int ref, int mv_dir, int mv_type,
int
mb_x
,
int
mb_y
,
int
mb_intra
,
int
mb_skipped
)
{
H264Context
*
h
=
opaque
;
H264SliceContext
*
sl
=
&
h
->
slice_ctx
[
0
];
h
->
mb_x
=
mb_x
;
h
->
mb_y
=
mb_y
;
h
->
mb_xy
=
mb_x
+
mb_y
*
h
->
mb_stride
;
memset
(
h
->
non_zero_count_cache
,
0
,
sizeof
(
h
->
non_zero_count_cache
));
memset
(
sl
->
non_zero_count_cache
,
0
,
sizeof
(
sl
->
non_zero_count_cache
));
assert
(
ref
>=
0
);
/* FIXME: It is possible albeit uncommon that slice references
* differ between slices. We take the easy approach and ignore
...
...
libavcodec/h264.h
View file @
f69574cf
...
...
@@ -341,6 +341,12 @@ typedef struct H264SliceContext {
unsigned
int
top_samples_available
;
unsigned
int
topright_samples_available
;
unsigned
int
left_samples_available
;
/**
* non zero coeff count cache.
* is 64 if not available.
*/
DECLARE_ALIGNED
(
8
,
uint8_t
,
non_zero_count_cache
)[
15
*
8
];
}
H264SliceContext
;
/**
...
...
@@ -381,12 +387,6 @@ typedef struct H264Context {
H264PredContext
hpc
;
uint8_t
(
*
top_borders
[
2
])[(
16
*
3
)
*
2
];
/**
* non zero coeff count cache.
* is 64 if not available.
*/
DECLARE_ALIGNED
(
8
,
uint8_t
,
non_zero_count_cache
)[
15
*
8
];
uint8_t
(
*
non_zero_count
)[
48
];
/**
...
...
@@ -944,11 +944,12 @@ static av_always_inline void write_back_intra_pred_mode(H264Context *h,
i4x4
[
6
]
=
i4x4_cache
[
7
+
8
*
1
];
}
static
av_always_inline
void
write_back_non_zero_count
(
H264Context
*
h
)
static
av_always_inline
void
write_back_non_zero_count
(
H264Context
*
h
,
H264SliceContext
*
sl
)
{
const
int
mb_xy
=
h
->
mb_xy
;
uint8_t
*
nnz
=
h
->
non_zero_count
[
mb_xy
];
uint8_t
*
nnz_cache
=
h
->
non_zero_count_cache
;
uint8_t
*
nnz_cache
=
sl
->
non_zero_count_cache
;
AV_COPY32
(
&
nnz
[
0
],
&
nnz_cache
[
4
+
8
*
1
]);
AV_COPY32
(
&
nnz
[
4
],
&
nnz_cache
[
4
+
8
*
2
]);
...
...
libavcodec/h264_cabac.c
View file @
f69574cf
This diff is collapsed.
Click to expand it.
libavcodec/h264_cavlc.c
View file @
f69574cf
...
...
@@ -283,10 +283,11 @@ static int8_t cavlc_level_tab[7][1<<LEVEL_TAB_BITS][2];
* Get the predicted number of non-zero coefficients.
* @param n block index
*/
static
inline
int
pred_non_zero_count
(
H264Context
*
h
,
int
n
){
static
inline
int
pred_non_zero_count
(
H264Context
*
h
,
H264SliceContext
*
sl
,
int
n
)
{
const
int
index8
=
scan8
[
n
];
const
int
left
=
h
->
non_zero_count_cache
[
index8
-
1
];
const
int
top
=
h
->
non_zero_count_cache
[
index8
-
8
];
const
int
left
=
sl
->
non_zero_count_cache
[
index8
-
1
];
const
int
top
=
sl
->
non_zero_count_cache
[
index8
-
8
];
int
i
=
left
+
top
;
if
(
i
<
64
)
i
=
(
i
+
1
)
>>
1
;
...
...
@@ -441,7 +442,11 @@ static inline int get_level_prefix(GetBitContext *gb){
* @param max_coeff number of coefficients in the block
* @return <0 if an error occurred
*/
static
int
decode_residual
(
H264Context
*
h
,
GetBitContext
*
gb
,
int16_t
*
block
,
int
n
,
const
uint8_t
*
scantable
,
const
uint32_t
*
qmul
,
int
max_coeff
){
static
int
decode_residual
(
H264Context
*
h
,
H264SliceContext
*
sl
,
GetBitContext
*
gb
,
int16_t
*
block
,
int
n
,
const
uint8_t
*
scantable
,
const
uint32_t
*
qmul
,
int
max_coeff
)
{
static
const
int
coeff_token_table_index
[
17
]
=
{
0
,
0
,
1
,
1
,
2
,
2
,
2
,
2
,
3
,
3
,
3
,
3
,
3
,
3
,
3
,
3
,
3
};
int
level
[
16
];
int
zeros_left
,
coeff_token
,
total_coeff
,
i
,
trailing_ones
,
run_before
;
...
...
@@ -456,16 +461,16 @@ static int decode_residual(H264Context *h, GetBitContext *gb, int16_t *block, in
total_coeff
=
coeff_token
>>
2
;
}
else
{
if
(
n
>=
LUMA_DC_BLOCK_INDEX
){
total_coeff
=
pred_non_zero_count
(
h
,
(
n
-
LUMA_DC_BLOCK_INDEX
)
*
16
);
total_coeff
=
pred_non_zero_count
(
h
,
sl
,
(
n
-
LUMA_DC_BLOCK_INDEX
)
*
16
);
coeff_token
=
get_vlc2
(
gb
,
coeff_token_vlc
[
coeff_token_table_index
[
total_coeff
]
].
table
,
COEFF_TOKEN_VLC_BITS
,
2
);
total_coeff
=
coeff_token
>>
2
;
}
else
{
total_coeff
=
pred_non_zero_count
(
h
,
n
);
total_coeff
=
pred_non_zero_count
(
h
,
sl
,
n
);
coeff_token
=
get_vlc2
(
gb
,
coeff_token_vlc
[
coeff_token_table_index
[
total_coeff
]
].
table
,
COEFF_TOKEN_VLC_BITS
,
2
);
total_coeff
=
coeff_token
>>
2
;
}
}
h
->
non_zero_count_cache
[
scan8
[
n
]
]
=
total_coeff
;
sl
->
non_zero_count_cache
[
scan8
[
n
]]
=
total_coeff
;
//FIXME set last_non_zero?
...
...
@@ -631,7 +636,7 @@ static av_always_inline int decode_luma_residual(H264Context *h, H264SliceContex
AV_ZERO128
(
h
->
mb_luma_dc
[
p
]
+
8
);
AV_ZERO128
(
h
->
mb_luma_dc
[
p
]
+
16
);
AV_ZERO128
(
h
->
mb_luma_dc
[
p
]
+
24
);
if
(
decode_residual
(
h
,
h
->
intra_gb_ptr
,
h
->
mb_luma_dc
[
p
],
LUMA_DC_BLOCK_INDEX
+
p
,
scan
,
NULL
,
16
)
<
0
){
if
(
decode_residual
(
h
,
sl
,
h
->
intra_gb_ptr
,
h
->
mb_luma_dc
[
p
],
LUMA_DC_BLOCK_INDEX
+
p
,
scan
,
NULL
,
16
)
<
0
){
return
-
1
;
//FIXME continue if partitioned and other return -1 too
}
...
...
@@ -641,7 +646,7 @@ static av_always_inline int decode_luma_residual(H264Context *h, H264SliceContex
for
(
i8x8
=
0
;
i8x8
<
4
;
i8x8
++
){
for
(
i4x4
=
0
;
i4x4
<
4
;
i4x4
++
){
const
int
index
=
i4x4
+
4
*
i8x8
+
p
*
16
;
if
(
decode_residual
(
h
,
h
->
intra_gb_ptr
,
h
->
mb
+
(
16
*
index
<<
pixel_shift
),
if
(
decode_residual
(
h
,
sl
,
h
->
intra_gb_ptr
,
h
->
mb
+
(
16
*
index
<<
pixel_shift
),
index
,
scan
+
1
,
h
->
dequant4_coeff
[
p
][
qscale
],
15
)
<
0
){
return
-
1
;
}
...
...
@@ -649,7 +654,7 @@ static av_always_inline int decode_luma_residual(H264Context *h, H264SliceContex
}
return
0xf
;
}
else
{
fill_rectangle
(
&
h
->
non_zero_count_cache
[
scan8
[
p
*
16
]],
4
,
4
,
8
,
0
,
1
);
fill_rectangle
(
&
sl
->
non_zero_count_cache
[
scan8
[
p
*
16
]],
4
,
4
,
8
,
0
,
1
);
return
0
;
}
}
else
{
...
...
@@ -663,25 +668,25 @@ static av_always_inline int decode_luma_residual(H264Context *h, H264SliceContex
uint8_t
*
nnz
;
for
(
i4x4
=
0
;
i4x4
<
4
;
i4x4
++
){
const
int
index
=
i4x4
+
4
*
i8x8
+
p
*
16
;
if
(
decode_residual
(
h
,
gb
,
buf
,
index
,
scan8x8
+
16
*
i4x4
,
if
(
decode_residual
(
h
,
sl
,
gb
,
buf
,
index
,
scan8x8
+
16
*
i4x4
,
h
->
dequant8_coeff
[
cqm
][
qscale
],
16
)
<
0
)
return
-
1
;
}
nnz
=
&
h
->
non_zero_count_cache
[
scan8
[
4
*
i8x8
+
p
*
16
]
];
nnz
=
&
sl
->
non_zero_count_cache
[
scan8
[
4
*
i8x8
+
p
*
16
]
];
nnz
[
0
]
+=
nnz
[
1
]
+
nnz
[
8
]
+
nnz
[
9
];
new_cbp
|=
!!
nnz
[
0
]
<<
i8x8
;
}
else
{
for
(
i4x4
=
0
;
i4x4
<
4
;
i4x4
++
){
const
int
index
=
i4x4
+
4
*
i8x8
+
p
*
16
;
if
(
decode_residual
(
h
,
gb
,
h
->
mb
+
(
16
*
index
<<
pixel_shift
),
index
,
if
(
decode_residual
(
h
,
sl
,
gb
,
h
->
mb
+
(
16
*
index
<<
pixel_shift
),
index
,
scan
,
h
->
dequant4_coeff
[
cqm
][
qscale
],
16
)
<
0
){
return
-
1
;
}
new_cbp
|=
h
->
non_zero_count_cache
[
scan8
[
index
]
]
<<
i8x8
;
new_cbp
|=
sl
->
non_zero_count_cache
[
scan8
[
index
]
]
<<
i8x8
;
}
}
}
else
{
uint8_t
*
const
nnz
=
&
h
->
non_zero_count_cache
[
scan8
[
4
*
i8x8
+
p
*
16
]
];
uint8_t
*
const
nnz
=
&
sl
->
non_zero_count_cache
[
scan8
[
4
*
i8x8
+
p
*
16
]
];
nnz
[
0
]
=
nnz
[
1
]
=
nnz
[
8
]
=
nnz
[
9
]
=
0
;
}
}
...
...
@@ -1120,7 +1125,7 @@ decode_intra_mb:
}
else
if
(
CHROMA422
(
h
))
{
if
(
cbp
&
0x30
){
for
(
chroma_idx
=
0
;
chroma_idx
<
2
;
chroma_idx
++
)
if
(
decode_residual
(
h
,
gb
,
h
->
mb
+
((
256
+
16
*
16
*
chroma_idx
)
<<
pixel_shift
),
if
(
decode_residual
(
h
,
sl
,
gb
,
h
->
mb
+
((
256
+
16
*
16
*
chroma_idx
)
<<
pixel_shift
),
CHROMA_DC_BLOCK_INDEX
+
chroma_idx
,
chroma422_dc_scan
,
NULL
,
8
)
<
0
)
{
return
-
1
;
...
...
@@ -1134,20 +1139,20 @@ decode_intra_mb:
for
(
i8x8
=
0
;
i8x8
<
2
;
i8x8
++
)
{
for
(
i4x4
=
0
;
i4x4
<
4
;
i4x4
++
)
{
const
int
index
=
16
+
16
*
chroma_idx
+
8
*
i8x8
+
i4x4
;
if
(
decode_residual
(
h
,
gb
,
mb
,
index
,
scan
+
1
,
qmul
,
15
)
<
0
)
if
(
decode_residual
(
h
,
sl
,
gb
,
mb
,
index
,
scan
+
1
,
qmul
,
15
)
<
0
)
return
-
1
;
mb
+=
16
<<
pixel_shift
;
}
}
}
}
else
{
fill_rectangle
(
&
h
->
non_zero_count_cache
[
scan8
[
16
]],
4
,
4
,
8
,
0
,
1
);
fill_rectangle
(
&
h
->
non_zero_count_cache
[
scan8
[
32
]],
4
,
4
,
8
,
0
,
1
);
fill_rectangle
(
&
sl
->
non_zero_count_cache
[
scan8
[
16
]],
4
,
4
,
8
,
0
,
1
);
fill_rectangle
(
&
sl
->
non_zero_count_cache
[
scan8
[
32
]],
4
,
4
,
8
,
0
,
1
);
}
}
else
/* yuv420 */
{
if
(
cbp
&
0x30
){
for
(
chroma_idx
=
0
;
chroma_idx
<
2
;
chroma_idx
++
)
if
(
decode_residual
(
h
,
gb
,
h
->
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
,
h
->
mb
+
((
256
+
16
*
16
*
chroma_idx
)
<<
pixel_shift
),
CHROMA_DC_BLOCK_INDEX
+
chroma_idx
,
chroma_dc_scan
,
NULL
,
4
)
<
0
){
return
-
1
;
}
}
...
...
@@ -1157,23 +1162,23 @@ decode_intra_mb:
const
uint32_t
*
qmul
=
h
->
dequant4_coeff
[
chroma_idx
+
1
+
(
IS_INTRA
(
mb_type
)
?
0
:
3
)][
sl
->
chroma_qp
[
chroma_idx
]];
for
(
i4x4
=
0
;
i4x4
<
4
;
i4x4
++
){
const
int
index
=
16
+
16
*
chroma_idx
+
i4x4
;
if
(
decode_residual
(
h
,
gb
,
h
->
mb
+
(
16
*
index
<<
pixel_shift
),
index
,
scan
+
1
,
qmul
,
15
)
<
0
){
if
(
decode_residual
(
h
,
sl
,
gb
,
h
->
mb
+
(
16
*
index
<<
pixel_shift
),
index
,
scan
+
1
,
qmul
,
15
)
<
0
){
return
-
1
;
}
}
}
}
else
{
fill_rectangle
(
&
h
->
non_zero_count_cache
[
scan8
[
16
]],
4
,
4
,
8
,
0
,
1
);
fill_rectangle
(
&
h
->
non_zero_count_cache
[
scan8
[
32
]],
4
,
4
,
8
,
0
,
1
);
fill_rectangle
(
&
sl
->
non_zero_count_cache
[
scan8
[
16
]],
4
,
4
,
8
,
0
,
1
);
fill_rectangle
(
&
sl
->
non_zero_count_cache
[
scan8
[
32
]],
4
,
4
,
8
,
0
,
1
);
}
}
}
else
{
fill_rectangle
(
&
h
->
non_zero_count_cache
[
scan8
[
0
]],
4
,
4
,
8
,
0
,
1
);
fill_rectangle
(
&
h
->
non_zero_count_cache
[
scan8
[
16
]],
4
,
4
,
8
,
0
,
1
);
fill_rectangle
(
&
h
->
non_zero_count_cache
[
scan8
[
32
]],
4
,
4
,
8
,
0
,
1
);
fill_rectangle
(
&
sl
->
non_zero_count_cache
[
scan8
[
0
]],
4
,
4
,
8
,
0
,
1
);
fill_rectangle
(
&
sl
->
non_zero_count_cache
[
scan8
[
16
]],
4
,
4
,
8
,
0
,
1
);
fill_rectangle
(
&
sl
->
non_zero_count_cache
[
scan8
[
32
]],
4
,
4
,
8
,
0
,
1
);
}
h
->
cur_pic
.
qscale_table
[
mb_xy
]
=
sl
->
qscale
;
write_back_non_zero_count
(
h
);
write_back_non_zero_count
(
h
,
sl
);
return
0
;
}
libavcodec/h264_loopfilter.c
View file @
f69574cf
...
...
@@ -371,7 +371,7 @@ static av_always_inline void h264_filter_mb_fast_internal(H264Context *h,
int
mask_edge0
=
3
*
((
mask_edge1
>>
1
)
&
((
5
*
left_type
)
>>
5
)
&
1
);
// (mb_type & (MB_TYPE_16x16 | MB_TYPE_8x16)) && (h->left_type[LTOP] & (MB_TYPE_16x16 | MB_TYPE_8x16)) ? 3 : 0;
int
step
=
1
+
(
mb_type
>>
24
);
//IS_8x8DCT(mb_type) ? 2 : 1;
edges
=
4
-
3
*
((
mb_type
>>
3
)
&
!
(
h
->
cbp
&
15
));
//(mb_type & MB_TYPE_16x16) && !(h->cbp & 15) ? 1 : 4;
h
->
h264dsp
.
h264_loop_filter_strength
(
bS
,
h
->
non_zero_count_cache
,
h
->
ref_cache
,
h
->
mv_cache
,
h
->
h264dsp
.
h264_loop_filter_strength
(
bS
,
sl
->
non_zero_count_cache
,
h
->
ref_cache
,
h
->
mv_cache
,
h
->
list_count
==
2
,
edges
,
step
,
mask_edge0
,
mask_edge1
,
FIELD_PICTURE
(
h
));
}
if
(
IS_INTRA
(
left_type
)
)
...
...
@@ -512,15 +512,15 @@ static av_always_inline void filter_mb_dir(H264Context *h, H264SliceContext *sl,
AV_WN64A
(
bS
,
0x0003000300030003ULL
);
}
else
{
if
(
!
CABAC
(
h
)
&&
IS_8x8DCT
(
h
->
cur_pic
.
mb_type
[
mbn_xy
]))
{
bS
[
0
]
=
1
+
((
h
->
cbp_table
[
mbn_xy
]
&
0x4000
)
||
h
->
non_zero_count_cache
[
scan8
[
0
]
+
0
]);
bS
[
1
]
=
1
+
((
h
->
cbp_table
[
mbn_xy
]
&
0x4000
)
||
h
->
non_zero_count_cache
[
scan8
[
0
]
+
1
]);
bS
[
2
]
=
1
+
((
h
->
cbp_table
[
mbn_xy
]
&
0x8000
)
||
h
->
non_zero_count_cache
[
scan8
[
0
]
+
2
]);
bS
[
3
]
=
1
+
((
h
->
cbp_table
[
mbn_xy
]
&
0x8000
)
||
h
->
non_zero_count_cache
[
scan8
[
0
]
+
3
]);
bS
[
0
]
=
1
+
((
h
->
cbp_table
[
mbn_xy
]
&
0x4000
)
||
sl
->
non_zero_count_cache
[
scan8
[
0
]
+
0
]);
bS
[
1
]
=
1
+
((
h
->
cbp_table
[
mbn_xy
]
&
0x4000
)
||
sl
->
non_zero_count_cache
[
scan8
[
0
]
+
1
]);
bS
[
2
]
=
1
+
((
h
->
cbp_table
[
mbn_xy
]
&
0x8000
)
||
sl
->
non_zero_count_cache
[
scan8
[
0
]
+
2
]);
bS
[
3
]
=
1
+
((
h
->
cbp_table
[
mbn_xy
]
&
0x8000
)
||
sl
->
non_zero_count_cache
[
scan8
[
0
]
+
3
]);
}
else
{
const
uint8_t
*
mbn_nnz
=
h
->
non_zero_count
[
mbn_xy
]
+
3
*
4
;
int
i
;
for
(
i
=
0
;
i
<
4
;
i
++
)
{
bS
[
i
]
=
1
+
!!
(
h
->
non_zero_count_cache
[
scan8
[
0
]
+
i
]
|
mbn_nnz
[
i
]);
bS
[
i
]
=
1
+
!!
(
sl
->
non_zero_count_cache
[
scan8
[
0
]
+
i
]
|
mbn_nnz
[
i
]);
}
}
}
...
...
@@ -576,8 +576,8 @@ static av_always_inline void filter_mb_dir(H264Context *h, H264SliceContext *sl,
int
b_idx
=
8
+
4
+
x
+
8
*
y
;
int
bn_idx
=
b_idx
-
(
dir
?
8
:
1
);
if
(
h
->
non_zero_count_cache
[
b_idx
]
|
h
->
non_zero_count_cache
[
bn_idx
]
)
{
if
(
sl
->
non_zero_count_cache
[
b_idx
]
|
sl
->
non_zero_count_cache
[
bn_idx
]
)
{
bS
[
i
]
=
2
;
}
else
if
(
!
mv_done
)
...
...
@@ -657,8 +657,8 @@ static av_always_inline void filter_mb_dir(H264Context *h, H264SliceContext *sl,
int
b_idx
=
8
+
4
+
x
+
8
*
y
;
int
bn_idx
=
b_idx
-
(
dir
?
8
:
1
);
if
(
h
->
non_zero_count_cache
[
b_idx
]
|
h
->
non_zero_count_cache
[
bn_idx
]
)
{
if
(
sl
->
non_zero_count_cache
[
b_idx
]
|
sl
->
non_zero_count_cache
[
bn_idx
]
)
{
bS
[
i
]
=
2
;
}
else
if
(
!
mv_done
)
...
...
@@ -763,7 +763,7 @@ void ff_h264_filter_mb(H264Context *h, H264SliceContext *sl,
if
(
IS_INTRA
(
mbn_type
)
)
bS
[
i
]
=
4
;
else
{
bS
[
i
]
=
1
+
!!
(
h
->
non_zero_count_cache
[
12
+
8
*
(
i
>>
1
)]
|
bS
[
i
]
=
1
+
!!
(
sl
->
non_zero_count_cache
[
12
+
8
*
(
i
>>
1
)]
|
((
!
h
->
pps
.
cabac
&&
IS_8x8DCT
(
mbn_type
))
?
(
h
->
cbp_table
[
mbn_xy
]
&
(((
MB_FIELD
(
h
)
?
(
i
&
2
)
:
(
mb_y
&
1
))
?
8
:
2
)
<<
12
))
:
...
...
libavcodec/h264_mb.c
View file @
f69574cf
...
...
@@ -635,7 +635,7 @@ static av_always_inline void hl_decode_mb_predict_luma(H264Context *h,
if
(
transform_bypass
&&
h
->
sps
.
profile_idc
==
244
&&
dir
<=
1
)
{
h
->
hpc
.
pred8x8l_add
[
dir
](
ptr
,
h
->
mb
+
(
i
*
16
+
p
*
256
<<
pixel_shift
),
linesize
);
}
else
{
const
int
nnz
=
h
->
non_zero_count_cache
[
scan8
[
i
+
p
*
16
]];
const
int
nnz
=
sl
->
non_zero_count_cache
[
scan8
[
i
+
p
*
16
]];
h
->
hpc
.
pred8x8l
[
dir
](
ptr
,
(
sl
->
topleft_samples_available
<<
i
)
&
0x8000
,
(
sl
->
topright_samples_available
<<
i
)
&
0x4000
,
linesize
);
if
(
nnz
)
{
...
...
@@ -681,7 +681,7 @@ static av_always_inline void hl_decode_mb_predict_luma(H264Context *h,
topright
=
NULL
;
h
->
hpc
.
pred4x4
[
dir
](
ptr
,
topright
,
linesize
);
nnz
=
h
->
non_zero_count_cache
[
scan8
[
i
+
p
*
16
]];
nnz
=
sl
->
non_zero_count_cache
[
scan8
[
i
+
p
*
16
]];
if
(
nnz
)
{
if
(
is_h264
)
{
if
(
nnz
==
1
&&
dctcoef_get
(
h
->
mb
,
pixel_shift
,
i
*
16
+
p
*
256
))
...
...
@@ -697,7 +697,7 @@ static av_always_inline void hl_decode_mb_predict_luma(H264Context *h,
}
else
{
h
->
hpc
.
pred16x16
[
sl
->
intra16x16_pred_mode
](
dest_y
,
linesize
);
if
(
is_h264
)
{
if
(
h
->
non_zero_count_cache
[
scan8
[
LUMA_DC_BLOCK_INDEX
+
p
]])
{
if
(
sl
->
non_zero_count_cache
[
scan8
[
LUMA_DC_BLOCK_INDEX
+
p
]])
{
if
(
!
transform_bypass
)
h
->
h264dsp
.
h264_luma_dc_dequant_idct
(
h
->
mb
+
(
p
*
256
<<
pixel_shift
),
h
->
mb_luma_dc
[
p
],
...
...
@@ -746,7 +746,7 @@ static av_always_inline void hl_decode_mb_idct_luma(H264Context *h, H264SliceCon
linesize
);
}
else
{
for
(
i
=
0
;
i
<
16
;
i
++
)
if
(
h
->
non_zero_count_cache
[
scan8
[
i
+
p
*
16
]]
||
if
(
sl
->
non_zero_count_cache
[
scan8
[
i
+
p
*
16
]]
||
dctcoef_get
(
h
->
mb
,
pixel_shift
,
i
*
16
+
p
*
256
))
h
->
h264dsp
.
h264_add_pixels4_clear
(
dest_y
+
block_offset
[
i
],
h
->
mb
+
(
i
*
16
+
p
*
256
<<
pixel_shift
),
...
...
@@ -756,7 +756,7 @@ static av_always_inline void hl_decode_mb_idct_luma(H264Context *h, H264SliceCon
h
->
h264dsp
.
h264_idct_add16intra
(
dest_y
,
block_offset
,
h
->
mb
+
(
p
*
256
<<
pixel_shift
),
linesize
,
h
->
non_zero_count_cache
+
p
*
5
*
8
);
sl
->
non_zero_count_cache
+
p
*
5
*
8
);
}
}
else
if
(
h
->
cbp
&
15
)
{
if
(
transform_bypass
)
{
...
...
@@ -764,7 +764,7 @@ static av_always_inline void hl_decode_mb_idct_luma(H264Context *h, H264SliceCon
idct_add
=
IS_8x8DCT
(
mb_type
)
?
h
->
h264dsp
.
h264_add_pixels8_clear
:
h
->
h264dsp
.
h264_add_pixels4_clear
;
for
(
i
=
0
;
i
<
16
;
i
+=
di
)
if
(
h
->
non_zero_count_cache
[
scan8
[
i
+
p
*
16
]])
if
(
sl
->
non_zero_count_cache
[
scan8
[
i
+
p
*
16
]])
idct_add
(
dest_y
+
block_offset
[
i
],
h
->
mb
+
(
i
*
16
+
p
*
256
<<
pixel_shift
),
linesize
);
...
...
@@ -773,17 +773,17 @@ static av_always_inline void hl_decode_mb_idct_luma(H264Context *h, H264SliceCon
h
->
h264dsp
.
h264_idct8_add4
(
dest_y
,
block_offset
,
h
->
mb
+
(
p
*
256
<<
pixel_shift
),
linesize
,
h
->
non_zero_count_cache
+
p
*
5
*
8
);
sl
->
non_zero_count_cache
+
p
*
5
*
8
);
else
h
->
h264dsp
.
h264_idct_add16
(
dest_y
,
block_offset
,
h
->
mb
+
(
p
*
256
<<
pixel_shift
),
linesize
,
h
->
non_zero_count_cache
+
p
*
5
*
8
);
sl
->
non_zero_count_cache
+
p
*
5
*
8
);
}
}
}
else
if
(
CONFIG_SVQ3_DECODER
)
{
for
(
i
=
0
;
i
<
16
;
i
++
)
if
(
h
->
non_zero_count_cache
[
scan8
[
i
+
p
*
16
]]
||
h
->
mb
[
i
*
16
+
p
*
256
])
{
if
(
sl
->
non_zero_count_cache
[
scan8
[
i
+
p
*
16
]]
||
h
->
mb
[
i
*
16
+
p
*
256
])
{
// FIXME benchmark weird rule, & below
uint8_t
*
const
ptr
=
dest_y
+
block_offset
[
i
];
ff_svq3_add_idct_c
(
ptr
,
h
->
mb
+
i
*
16
+
p
*
256
,
linesize
,
...
...
libavcodec/h264_mb_template.c
View file @
f69574cf
...
...
@@ -212,14 +212,14 @@ static av_noinline void FUNC(hl_decode_mb)(H264Context *h, H264SliceContext *sl)
idct_add
=
h
->
h264dsp
.
h264_add_pixels4_clear
;
for
(
j
=
1
;
j
<
3
;
j
++
)
{
for
(
i
=
j
*
16
;
i
<
j
*
16
+
4
;
i
++
)
if
(
h
->
non_zero_count_cache
[
scan8
[
i
]]
||
if
(
sl
->
non_zero_count_cache
[
scan8
[
i
]]
||
dctcoef_get
(
h
->
mb
,
PIXEL_SHIFT
,
i
*
16
))
idct_add
(
dest
[
j
-
1
]
+
block_offset
[
i
],
h
->
mb
+
(
i
*
16
<<
PIXEL_SHIFT
),
uvlinesize
);
if
(
chroma422
)
{
for
(
i
=
j
*
16
+
4
;
i
<
j
*
16
+
8
;
i
++
)
if
(
h
->
non_zero_count_cache
[
scan8
[
i
+
4
]]
||
if
(
sl
->
non_zero_count_cache
[
scan8
[
i
+
4
]]
||
dctcoef_get
(
h
->
mb
,
PIXEL_SHIFT
,
i
*
16
))
idct_add
(
dest
[
j
-
1
]
+
block_offset
[
i
+
4
],
h
->
mb
+
(
i
*
16
<<
PIXEL_SHIFT
),
...
...
@@ -237,15 +237,15 @@ static av_noinline void FUNC(hl_decode_mb)(H264Context *h, H264SliceContext *sl)
qp
[
0
]
=
sl
->
chroma_qp
[
0
];
qp
[
1
]
=
sl
->
chroma_qp
[
1
];
}
if
(
h
->
non_zero_count_cache
[
scan8
[
CHROMA_DC_BLOCK_INDEX
+
0
]])
if
(
sl
->
non_zero_count_cache
[
scan8
[
CHROMA_DC_BLOCK_INDEX
+
0
]])
h
->
h264dsp
.
h264_chroma_dc_dequant_idct
(
h
->
mb
+
(
16
*
16
*
1
<<
PIXEL_SHIFT
),
h
->
dequant4_coeff
[
IS_INTRA
(
mb_type
)
?
1
:
4
][
qp
[
0
]][
0
]);
if
(
h
->
non_zero_count_cache
[
scan8
[
CHROMA_DC_BLOCK_INDEX
+
1
]])
if
(
sl
->
non_zero_count_cache
[
scan8
[
CHROMA_DC_BLOCK_INDEX
+
1
]])
h
->
h264dsp
.
h264_chroma_dc_dequant_idct
(
h
->
mb
+
(
16
*
16
*
2
<<
PIXEL_SHIFT
),
h
->
dequant4_coeff
[
IS_INTRA
(
mb_type
)
?
2
:
5
][
qp
[
1
]][
0
]);
h
->
h264dsp
.
h264_idct_add8
(
dest
,
block_offset
,
h
->
mb
,
uvlinesize
,
h
->
non_zero_count_cache
);
sl
->
non_zero_count_cache
);
}
else
if
(
CONFIG_SVQ3_DECODER
)
{
h
->
h264dsp
.
h264_chroma_dc_dequant_idct
(
h
->
mb
+
16
*
16
*
1
,
h
->
dequant4_coeff
[
IS_INTRA
(
mb_type
)
?
1
:
4
][
sl
->
chroma_qp
[
0
]][
0
]);
...
...
@@ -253,7 +253,7 @@ static av_noinline void FUNC(hl_decode_mb)(H264Context *h, H264SliceContext *sl)
h
->
dequant4_coeff
[
IS_INTRA
(
mb_type
)
?
2
:
5
][
sl
->
chroma_qp
[
1
]][
0
]);
for
(
j
=
1
;
j
<
3
;
j
++
)
{
for
(
i
=
j
*
16
;
i
<
j
*
16
+
4
;
i
++
)
if
(
h
->
non_zero_count_cache
[
scan8
[
i
]]
||
h
->
mb
[
i
*
16
])
{
if
(
sl
->
non_zero_count_cache
[
scan8
[
i
]]
||
h
->
mb
[
i
*
16
])
{
uint8_t
*
const
ptr
=
dest
[
j
-
1
]
+
block_offset
[
i
];
ff_svq3_add_idct_c
(
ptr
,
h
->
mb
+
i
*
16
,
uvlinesize
,
...
...
libavcodec/h264_mvpred.h
View file @
f69574cf
...
...
@@ -539,7 +539,7 @@ static void fill_decode_caches(H264Context *h, H264SliceContext *sl, int mb_type
*/
/* FIXME: constraint_intra_pred & partitioning & nnz
* (let us hope this is just a typo in the spec) */
nnz_cache
=
h
->
non_zero_count_cache
;
nnz_cache
=
sl
->
non_zero_count_cache
;
if
(
top_type
)
{
nnz
=
h
->
non_zero_count
[
top_xy
];
AV_COPY32
(
&
nnz_cache
[
4
+
8
*
0
],
&
nnz
[
4
*
3
]);
...
...
libavcodec/h264_slice.c
View file @
f69574cf
...
...
@@ -1986,7 +1986,7 @@ static int fill_filter_caches(H264Context *h, H264SliceContext *sl, int mb_type)
top_type
,
left_type
,
mb_xy
,
1
);
nnz
=
h
->
non_zero_count
[
mb_xy
];
nnz_cache
=
h
->
non_zero_count_cache
;
nnz_cache
=
sl
->
non_zero_count_cache
;
AV_COPY32
(
&
nnz_cache
[
4
+
8
*
1
],
&
nnz
[
0
]);
AV_COPY32
(
&
nnz_cache
[
4
+
8
*
2
],
&
nnz
[
4
]);
AV_COPY32
(
&
nnz_cache
[
4
+
8
*
3
],
&
nnz
[
8
]);
...
...
libavcodec/svq3.c
View file @
f69574cf
...
...
@@ -684,7 +684,7 @@ static int svq3_decode_mb(SVQ3Context *s, unsigned int mb_type)
memset
(
sl
->
intra4x4_pred_mode
+
h
->
mb2br_xy
[
mb_xy
],
DC_PRED
,
8
);
}
if
(
!
IS_SKIP
(
mb_type
)
||
h
->
pict_type
==
AV_PICTURE_TYPE_B
)
{
memset
(
h
->
non_zero_count_cache
+
8
,
0
,
14
*
8
*
sizeof
(
uint8_t
));
memset
(
sl
->
non_zero_count_cache
+
8
,
0
,
14
*
8
*
sizeof
(
uint8_t
));
}
if
(
!
IS_INTRA16x16
(
mb_type
)
&&
...
...
@@ -726,7 +726,7 @@ static int svq3_decode_mb(SVQ3Context *s, unsigned int mb_type)
k
=
index
?
(
1
*
(
j
&
1
)
+
2
*
(
i
&
1
)
+
2
*
(
j
&
2
)
+
4
*
(
i
&
2
))
:
(
4
*
i
+
j
);
h
->
non_zero_count_cache
[
scan8
[
k
]]
=
1
;
sl
->
non_zero_count_cache
[
scan8
[
k
]]
=
1
;
if
(
svq3_decode_block
(
&
h
->
gb
,
&
h
->
mb
[
16
*
k
],
index
,
type
))
{
av_log
(
h
->
avctx
,
AV_LOG_ERROR
,
...
...
@@ -748,7 +748,7 @@ static int svq3_decode_mb(SVQ3Context *s, unsigned int mb_type)
for
(
i
=
1
;
i
<
3
;
i
++
)
{
for
(
j
=
0
;
j
<
4
;
j
++
)
{
k
=
16
*
i
+
j
;
h
->
non_zero_count_cache
[
scan8
[
k
]]
=
1
;
sl
->
non_zero_count_cache
[
scan8
[
k
]]
=
1
;
if
(
svq3_decode_block
(
&
h
->
gb
,
&
h
->
mb
[
16
*
k
],
1
,
1
))
{
av_log
(
h
->
avctx
,
AV_LOG_ERROR
,
...
...
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