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
e7226984
Commit
e7226984
authored
Jan 17, 2015
by
Anton Khirnov
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
h264: move [{top,left}_]cbp into the per-slice context
parent
30da98ad
Hide whitespace changes
Inline
Side-by-side
Showing
9 changed files
with
30 additions
and
28 deletions
+30
-28
h264.h
libavcodec/h264.h
+5
-3
h264_cabac.c
libavcodec/h264_cabac.c
+9
-9
h264_cavlc.c
libavcodec/h264_cavlc.c
+1
-1
h264_loopfilter.c
libavcodec/h264_loopfilter.c
+3
-3
h264_mb.c
libavcodec/h264_mb.c
+1
-1
h264_mb_template.c
libavcodec/h264_mb_template.c
+1
-1
h264_mvpred.h
libavcodec/h264_mvpred.h
+4
-4
h264_slice.c
libavcodec/h264_slice.c
+5
-5
svq3.c
libavcodec/svq3.c
+1
-1
No files found.
libavcodec/h264.h
View file @
e7226984
...
...
@@ -359,6 +359,10 @@ typedef struct H264SliceContext {
int
col_parity
;
int
col_fieldoff
;
int
cbp
;
int
top_cbp
;
int
left_cbp
;
int
dist_scale_factor
[
32
];
int
dist_scale_factor_field
[
2
][
32
];
int
map_col_to_list0
[
2
][
16
+
32
];
...
...
@@ -484,9 +488,7 @@ typedef struct H264Context {
/* 0x100 -> non null luma_dc, 0x80/0x40 -> non null chroma_dc (cb/cr), 0x?0 -> chroma_cbp(0, 1, 2), 0x0? luma_cbp */
uint16_t
*
cbp_table
;
int
cbp
;
int
top_cbp
;
int
left_cbp
;
/* chroma_pred_mode for i4x4 or i16x16, else 0 */
uint8_t
*
chroma_pred_mode_table
;
int
last_qscale_diff
;
...
...
libavcodec/h264_cabac.c
View file @
e7226984
...
...
@@ -1406,8 +1406,8 @@ static int decode_cabac_mb_cbp_luma(H264Context *h, H264SliceContext *sl)
{
int
cbp_b
,
cbp_a
,
ctx
,
cbp
=
0
;
cbp_a
=
h
->
left_cbp
;
cbp_b
=
h
->
top_cbp
;
cbp_a
=
sl
->
left_cbp
;
cbp_b
=
sl
->
top_cbp
;
ctx
=
!
(
cbp_a
&
0x02
)
+
2
*
!
(
cbp_b
&
0x04
);
cbp
+=
get_cabac_noinline
(
&
sl
->
cabac
,
&
sl
->
cabac_state
[
73
+
ctx
]);
...
...
@@ -1424,8 +1424,8 @@ static int decode_cabac_mb_cbp_chroma(H264Context *h, H264SliceContext *sl)
int
ctx
;
int
cbp_a
,
cbp_b
;
cbp_a
=
(
h
->
left_cbp
>>
4
)
&
0x03
;
cbp_b
=
(
h
->
top_cbp
>>
4
)
&
0x03
;
cbp_a
=
(
sl
->
left_cbp
>>
4
)
&
0x03
;
cbp_b
=
(
sl
->
top_cbp
>>
4
)
&
0x03
;
ctx
=
0
;
if
(
cbp_a
>
0
)
ctx
++
;
...
...
@@ -1555,12 +1555,12 @@ static av_always_inline int get_cabac_cbf_ctx(H264Context *h, H264SliceContext *
if
(
is_dc
)
{
if
(
cat
==
3
)
{
idx
-=
CHROMA_DC_BLOCK_INDEX
;
nza
=
(
h
->
left_cbp
>>
(
6
+
idx
))
&
0x01
;
nzb
=
(
h
->
top_cbp
>>
(
6
+
idx
))
&
0x01
;
nza
=
(
sl
->
left_cbp
>>
(
6
+
idx
))
&
0x01
;
nzb
=
(
sl
->
top_cbp
>>
(
6
+
idx
))
&
0x01
;
}
else
{
idx
-=
LUMA_DC_BLOCK_INDEX
;
nza
=
h
->
left_cbp
&
(
0x100
<<
idx
);
nzb
=
h
->
top_cbp
&
(
0x100
<<
idx
);
nza
=
sl
->
left_cbp
&
(
0x100
<<
idx
);
nzb
=
sl
->
top_cbp
&
(
0x100
<<
idx
);
}
}
else
{
nza
=
sl
->
non_zero_count_cache
[
scan8
[
idx
]
-
1
];
...
...
@@ -2315,7 +2315,7 @@ decode_intra_mb:
cbp
|=
decode_cabac_mb_cbp_chroma
(
h
,
sl
)
<<
4
;
}
h
->
cbp_table
[
mb_xy
]
=
h
->
cbp
=
cbp
;
h
->
cbp_table
[
mb_xy
]
=
sl
->
cbp
=
cbp
;
if
(
dct8x8_allowed
&&
(
cbp
&
15
)
&&
!
IS_INTRA
(
mb_type
)
)
{
mb_type
|=
MB_TYPE_8x8DCT
*
get_cabac_noinline
(
&
sl
->
cabac
,
&
sl
->
cabac_state
[
399
+
sl
->
neighbor_transform_size
]);
...
...
libavcodec/h264_cavlc.c
View file @
e7226984
...
...
@@ -1075,7 +1075,7 @@ decode_intra_mb:
if
(
dct8x8_allowed
&&
(
cbp
&
15
)
&&
!
IS_INTRA
(
mb_type
)){
mb_type
|=
MB_TYPE_8x8DCT
*
get_bits1
(
&
h
->
gb
);
}
h
->
cbp
=
sl
->
cbp
=
h
->
cbp_table
[
mb_xy
]
=
cbp
;
h
->
cur_pic
.
mb_type
[
mb_xy
]
=
mb_type
;
...
...
libavcodec/h264_loopfilter.c
View file @
e7226984
...
...
@@ -360,7 +360,7 @@ static av_always_inline void h264_filter_mb_fast_internal(H264Context *h,
}
else
{
LOCAL_ALIGNED_8
(
int16_t
,
bS
,
[
2
],
[
4
][
4
]);
int
edges
;
if
(
IS_8x8DCT
(
mb_type
)
&&
(
h
->
cbp
&
7
)
==
7
&&
!
chroma444
)
{
if
(
IS_8x8DCT
(
mb_type
)
&&
(
sl
->
cbp
&
7
)
==
7
&&
!
chroma444
)
{
edges
=
4
;
AV_WN64A
(
bS
[
0
][
0
],
0x0002000200020002ULL
);
AV_WN64A
(
bS
[
0
][
2
],
0x0002000200020002ULL
);
...
...
@@ -370,7 +370,7 @@ static av_always_inline void h264_filter_mb_fast_internal(H264Context *h,
int
mask_edge1
=
(
3
*
(((
5
*
mb_type
)
>>
5
)
&
1
))
|
(
mb_type
>>
4
);
//(mb_type & (MB_TYPE_16x16 | MB_TYPE_8x16)) ? 3 : (mb_type & MB_TYPE_16x8) ? 1 : 0;
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;
edges
=
4
-
3
*
((
mb_type
>>
3
)
&
!
(
sl
->
cbp
&
15
));
//(mb_type & MB_TYPE_16x16) && !(h->cbp & 15) ? 1 : 4;
h
->
h264dsp
.
h264_loop_filter_strength
(
bS
,
sl
->
non_zero_count_cache
,
sl
->
ref_cache
,
sl
->
mv_cache
,
sl
->
list_count
==
2
,
edges
,
step
,
mask_edge0
,
mask_edge1
,
FIELD_PICTURE
(
h
));
}
...
...
@@ -487,7 +487,7 @@ static av_always_inline void filter_mb_dir(H264Context *h, H264SliceContext *sl,
static
const
uint8_t
mask_edge_tab
[
2
][
8
]
=
{{
0
,
3
,
3
,
3
,
1
,
1
,
1
,
1
},
{
0
,
3
,
1
,
1
,
3
,
3
,
3
,
3
}};
const
int
mask_edge
=
mask_edge_tab
[
dir
][(
mb_type
>>
3
)
&
7
];
const
int
edges
=
mask_edge
==
3
&&
!
(
h
->
cbp
&
15
)
?
1
:
4
;
const
int
edges
=
mask_edge
==
3
&&
!
(
sl
->
cbp
&
15
)
?
1
:
4
;
// how often to recheck mv-based bS when iterating along each edge
const
int
mask_par0
=
mb_type
&
(
MB_TYPE_16x16
|
(
MB_TYPE_8x16
>>
dir
));
...
...
libavcodec/h264_mb.c
View file @
e7226984
...
...
@@ -763,7 +763,7 @@ static av_always_inline void hl_decode_mb_idct_luma(H264Context *h, H264SliceCon
linesize
,
sl
->
non_zero_count_cache
+
p
*
5
*
8
);
}
}
else
if
(
h
->
cbp
&
15
)
{
}
else
if
(
sl
->
cbp
&
15
)
{
if
(
transform_bypass
)
{
const
int
di
=
IS_8x8DCT
(
mb_type
)
?
4
:
1
;
idct_add
=
IS_8x8DCT
(
mb_type
)
?
h
->
h264dsp
.
h264_add_pixels8_clear
...
...
libavcodec/h264_mb_template.c
View file @
e7226984
...
...
@@ -194,7 +194,7 @@ static av_noinline void FUNC(hl_decode_mb)(H264Context *h, H264SliceContext *sl)
PIXEL_SHIFT
,
block_offset
,
linesize
,
dest_y
,
0
);
if
((
SIMPLE
||
!
CONFIG_GRAY
||
!
(
h
->
flags
&
CODEC_FLAG_GRAY
))
&&
(
h
->
cbp
&
0x30
))
{
(
sl
->
cbp
&
0x30
))
{
uint8_t
*
dest
[
2
]
=
{
dest_cb
,
dest_cr
};
if
(
transform_bypass
)
{
if
(
IS_INTRA
(
mb_type
)
&&
h
->
sps
.
profile_idc
==
244
&&
...
...
libavcodec/h264_mvpred.h
View file @
e7226984
...
...
@@ -589,16 +589,16 @@ static void fill_decode_caches(H264Context *h, H264SliceContext *sl, int mb_type
if
(
CABAC
(
h
))
{
// top_cbp
if
(
top_type
)
h
->
top_cbp
=
h
->
cbp_table
[
top_xy
];
sl
->
top_cbp
=
h
->
cbp_table
[
top_xy
];
else
h
->
top_cbp
=
IS_INTRA
(
mb_type
)
?
0x7CF
:
0x00F
;
sl
->
top_cbp
=
IS_INTRA
(
mb_type
)
?
0x7CF
:
0x00F
;
// left_cbp
if
(
left_type
[
LTOP
])
{
h
->
left_cbp
=
(
h
->
cbp_table
[
left_xy
[
LTOP
]]
&
0x7F0
)
|
sl
->
left_cbp
=
(
h
->
cbp_table
[
left_xy
[
LTOP
]]
&
0x7F0
)
|
((
h
->
cbp_table
[
left_xy
[
LTOP
]]
>>
(
left_block
[
0
]
&
(
~
1
)))
&
2
)
|
(((
h
->
cbp_table
[
left_xy
[
LBOT
]]
>>
(
left_block
[
2
]
&
(
~
1
)))
&
2
)
<<
2
);
}
else
{
h
->
left_cbp
=
IS_INTRA
(
mb_type
)
?
0x7CF
:
0x00F
;
sl
->
left_cbp
=
IS_INTRA
(
mb_type
)
?
0x7CF
:
0x00F
;
}
}
}
...
...
libavcodec/h264_slice.c
View file @
e7226984
...
...
@@ -1993,7 +1993,7 @@ static int fill_filter_caches(H264Context *h, H264SliceContext *sl, int mb_type)
AV_COPY32
(
&
nnz_cache
[
4
+
8
*
2
],
&
nnz
[
4
]);
AV_COPY32
(
&
nnz_cache
[
4
+
8
*
3
],
&
nnz
[
8
]);
AV_COPY32
(
&
nnz_cache
[
4
+
8
*
4
],
&
nnz
[
12
]);
h
->
cbp
=
h
->
cbp_table
[
mb_xy
];
sl
->
cbp
=
h
->
cbp_table
[
mb_xy
];
if
(
top_type
)
{
nnz
=
h
->
non_zero_count
[
top_xy
];
...
...
@@ -2030,22 +2030,22 @@ static int fill_filter_caches(H264Context *h, H264SliceContext *sl, int mb_type)
nnz_cache
[
scan8
[
0
]]
=
nnz_cache
[
scan8
[
1
]]
=
nnz_cache
[
scan8
[
2
]]
=
nnz_cache
[
scan8
[
3
]]
=
(
h
->
cbp
&
0x1000
)
>>
12
;
nnz_cache
[
scan8
[
3
]]
=
(
sl
->
cbp
&
0x1000
)
>>
12
;
nnz_cache
[
scan8
[
0
+
4
]]
=
nnz_cache
[
scan8
[
1
+
4
]]
=
nnz_cache
[
scan8
[
2
+
4
]]
=
nnz_cache
[
scan8
[
3
+
4
]]
=
(
h
->
cbp
&
0x2000
)
>>
12
;
nnz_cache
[
scan8
[
3
+
4
]]
=
(
sl
->
cbp
&
0x2000
)
>>
12
;
nnz_cache
[
scan8
[
0
+
8
]]
=
nnz_cache
[
scan8
[
1
+
8
]]
=
nnz_cache
[
scan8
[
2
+
8
]]
=
nnz_cache
[
scan8
[
3
+
8
]]
=
(
h
->
cbp
&
0x4000
)
>>
12
;
nnz_cache
[
scan8
[
3
+
8
]]
=
(
sl
->
cbp
&
0x4000
)
>>
12
;
nnz_cache
[
scan8
[
0
+
12
]]
=
nnz_cache
[
scan8
[
1
+
12
]]
=
nnz_cache
[
scan8
[
2
+
12
]]
=
nnz_cache
[
scan8
[
3
+
12
]]
=
(
h
->
cbp
&
0x8000
)
>>
12
;
nnz_cache
[
scan8
[
3
+
12
]]
=
(
sl
->
cbp
&
0x8000
)
>>
12
;
}
}
...
...
libavcodec/svq3.c
View file @
e7226984
...
...
@@ -761,7 +761,7 @@ static int svq3_decode_mb(SVQ3Context *s, unsigned int mb_type)
}
}
h
->
cbp
=
cbp
;
sl
->
cbp
=
cbp
;
h
->
cur_pic
.
mb_type
[
mb_xy
]
=
mb_type
;
if
(
IS_INTRA
(
mb_type
))
...
...
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