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
e7077f5e
Commit
e7077f5e
authored
Apr 10, 2011
by
Michael Niedermayer
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
H264: replace pixel_size by pixel_shift
Signed-off-by:
Michael Niedermayer
<
michaelni@gmx.at
>
parent
9b271ce6
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
82 additions
and
82 deletions
+82
-82
h264.c
libavcodec/h264.c
+66
-66
h264.h
libavcodec/h264.h
+1
-1
h264_cabac.c
libavcodec/h264_cabac.c
+6
-6
h264_cavlc.c
libavcodec/h264_cavlc.c
+6
-6
h264_loopfilter.c
libavcodec/h264_loopfilter.c
+3
-3
No files found.
libavcodec/h264.c
View file @
e7077f5e
This diff is collapsed.
Click to expand it.
libavcodec/h264.h
View file @
e7077f5e
...
@@ -266,7 +266,7 @@ typedef struct MMCO{
...
@@ -266,7 +266,7 @@ typedef struct MMCO{
typedef
struct
H264Context
{
typedef
struct
H264Context
{
MpegEncContext
s
;
MpegEncContext
s
;
H264DSPContext
h264dsp
;
H264DSPContext
h264dsp
;
int
pixel_s
ize
;
int
pixel_s
hift
;
int
chroma_qp
[
2
];
//QPc
int
chroma_qp
[
2
];
//QPc
int
qp_thresh
;
///< QP threshold to skip loopfilter
int
qp_thresh
;
///< QP threshold to skip loopfilter
...
...
libavcodec/h264_cabac.c
View file @
e7077f5e
...
@@ -1143,7 +1143,7 @@ static av_always_inline void decode_cabac_residual_internal( H264Context *h, DCT
...
@@ -1143,7 +1143,7 @@ static av_always_inline void decode_cabac_residual_internal( H264Context *h, DCT
} \
} \
}
}
if
(
h
->
pixel_s
ize
==
2
)
{
if
(
h
->
pixel_s
hift
)
{
STORE_BLOCK
(
int32_t
)
STORE_BLOCK
(
int32_t
)
}
else
{
}
else
{
STORE_BLOCK
(
int16_t
)
STORE_BLOCK
(
int16_t
)
...
@@ -1670,7 +1670,7 @@ decode_intra_mb:
...
@@ -1670,7 +1670,7 @@ decode_intra_mb:
qmul
=
h
->
dequant4_coeff
[
0
][
s
->
qscale
];
qmul
=
h
->
dequant4_coeff
[
0
][
s
->
qscale
];
for
(
i
=
0
;
i
<
16
;
i
++
)
{
for
(
i
=
0
;
i
<
16
;
i
++
)
{
//av_log( s->avctx, AV_LOG_ERROR, "INTRA16x16 AC:%d\n", i );
//av_log( s->avctx, AV_LOG_ERROR, "INTRA16x16 AC:%d\n", i );
decode_cabac_residual_nondc
(
h
,
h
->
mb
+
16
*
i
*
h
->
pixel_size
,
1
,
i
,
scan
+
1
,
qmul
,
15
);
decode_cabac_residual_nondc
(
h
,
h
->
mb
+
(
16
*
i
<<
h
->
pixel_shift
)
,
1
,
i
,
scan
+
1
,
qmul
,
15
);
}
}
}
else
{
}
else
{
fill_rectangle
(
&
h
->
non_zero_count_cache
[
scan8
[
0
]],
4
,
4
,
8
,
0
,
1
);
fill_rectangle
(
&
h
->
non_zero_count_cache
[
scan8
[
0
]],
4
,
4
,
8
,
0
,
1
);
...
@@ -1680,7 +1680,7 @@ decode_intra_mb:
...
@@ -1680,7 +1680,7 @@ decode_intra_mb:
for
(
i8x8
=
0
;
i8x8
<
4
;
i8x8
++
)
{
for
(
i8x8
=
0
;
i8x8
<
4
;
i8x8
++
)
{
if
(
cbp
&
(
1
<<
i8x8
)
)
{
if
(
cbp
&
(
1
<<
i8x8
)
)
{
if
(
IS_8x8DCT
(
mb_type
)
)
{
if
(
IS_8x8DCT
(
mb_type
)
)
{
decode_cabac_residual_nondc
(
h
,
h
->
mb
+
64
*
i8x8
*
h
->
pixel_size
,
5
,
4
*
i8x8
,
decode_cabac_residual_nondc
(
h
,
h
->
mb
+
(
64
*
i8x8
<<
h
->
pixel_shift
)
,
5
,
4
*
i8x8
,
scan8x8
,
h
->
dequant8_coeff
[
IS_INTRA
(
mb_type
)
?
0
:
1
][
s
->
qscale
],
64
);
scan8x8
,
h
->
dequant8_coeff
[
IS_INTRA
(
mb_type
)
?
0
:
1
][
s
->
qscale
],
64
);
}
else
{
}
else
{
qmul
=
h
->
dequant4_coeff
[
IS_INTRA
(
mb_type
)
?
0
:
3
][
s
->
qscale
];
qmul
=
h
->
dequant4_coeff
[
IS_INTRA
(
mb_type
)
?
0
:
3
][
s
->
qscale
];
...
@@ -1688,7 +1688,7 @@ decode_intra_mb:
...
@@ -1688,7 +1688,7 @@ decode_intra_mb:
const
int
index
=
4
*
i8x8
+
i4x4
;
const
int
index
=
4
*
i8x8
+
i4x4
;
//av_log( s->avctx, AV_LOG_ERROR, "Luma4x4: %d\n", index );
//av_log( s->avctx, AV_LOG_ERROR, "Luma4x4: %d\n", index );
//START_TIMER
//START_TIMER
decode_cabac_residual_nondc
(
h
,
h
->
mb
+
16
*
index
*
h
->
pixel_size
,
2
,
index
,
scan
,
qmul
,
16
);
decode_cabac_residual_nondc
(
h
,
h
->
mb
+
(
16
*
index
<<
h
->
pixel_shift
)
,
2
,
index
,
scan
,
qmul
,
16
);
//STOP_TIMER("decode_residual")
//STOP_TIMER("decode_residual")
}
}
}
}
...
@@ -1703,7 +1703,7 @@ decode_intra_mb:
...
@@ -1703,7 +1703,7 @@ decode_intra_mb:
int
c
;
int
c
;
for
(
c
=
0
;
c
<
2
;
c
++
)
{
for
(
c
=
0
;
c
<
2
;
c
++
)
{
//av_log( s->avctx, AV_LOG_ERROR, "INTRA C%d-DC\n",c );
//av_log( s->avctx, AV_LOG_ERROR, "INTRA C%d-DC\n",c );
decode_cabac_residual_dc
(
h
,
h
->
mb
+
(
256
+
16
*
4
*
c
)
*
h
->
pixel_size
,
3
,
CHROMA_DC_BLOCK_INDEX
+
c
,
chroma_dc_scan
,
4
);
decode_cabac_residual_dc
(
h
,
h
->
mb
+
(
(
256
+
16
*
4
*
c
)
<<
h
->
pixel_shift
)
,
3
,
CHROMA_DC_BLOCK_INDEX
+
c
,
chroma_dc_scan
,
4
);
}
}
}
}
...
@@ -1714,7 +1714,7 @@ decode_intra_mb:
...
@@ -1714,7 +1714,7 @@ decode_intra_mb:
for
(
i
=
0
;
i
<
4
;
i
++
)
{
for
(
i
=
0
;
i
<
4
;
i
++
)
{
const
int
index
=
16
+
4
*
c
+
i
;
const
int
index
=
16
+
4
*
c
+
i
;
//av_log( s->avctx, AV_LOG_ERROR, "INTRA C%d-AC %d\n",c, index - 16 );
//av_log( s->avctx, AV_LOG_ERROR, "INTRA C%d-AC %d\n",c, index - 16 );
decode_cabac_residual_nondc
(
h
,
h
->
mb
+
16
*
index
*
h
->
pixel_size
,
4
,
index
,
scan
+
1
,
qmul
,
15
);
decode_cabac_residual_nondc
(
h
,
h
->
mb
+
(
16
*
index
<<
h
->
pixel_shift
)
,
4
,
index
,
scan
+
1
,
qmul
,
15
);
}
}
}
}
}
else
{
}
else
{
...
...
libavcodec/h264_cavlc.c
View file @
e7077f5e
...
@@ -522,7 +522,7 @@ static int decode_residual(H264Context *h, GetBitContext *gb, DCTELEM *block, in
...
@@ -522,7 +522,7 @@ static int decode_residual(H264Context *h, GetBitContext *gb, DCTELEM *block, in
} \
} \
}
}
if
(
h
->
pixel_s
ize
==
2
)
{
if
(
h
->
pixel_s
hift
)
{
STORE_BLOCK
(
int32_t
)
STORE_BLOCK
(
int32_t
)
}
else
{
}
else
{
STORE_BLOCK
(
int16_t
)
STORE_BLOCK
(
int16_t
)
...
@@ -961,7 +961,7 @@ decode_intra_mb:
...
@@ -961,7 +961,7 @@ decode_intra_mb:
for
(
i8x8
=
0
;
i8x8
<
4
;
i8x8
++
){
for
(
i8x8
=
0
;
i8x8
<
4
;
i8x8
++
){
for
(
i4x4
=
0
;
i4x4
<
4
;
i4x4
++
){
for
(
i4x4
=
0
;
i4x4
<
4
;
i4x4
++
){
const
int
index
=
i4x4
+
4
*
i8x8
;
const
int
index
=
i4x4
+
4
*
i8x8
;
if
(
decode_residual
(
h
,
h
->
intra_gb_ptr
,
h
->
mb
+
16
*
index
*
h
->
pixel_size
,
index
,
scan
+
1
,
h
->
dequant4_coeff
[
0
][
s
->
qscale
],
15
)
<
0
){
if
(
decode_residual
(
h
,
h
->
intra_gb_ptr
,
h
->
mb
+
(
16
*
index
<<
h
->
pixel_shift
)
,
index
,
scan
+
1
,
h
->
dequant4_coeff
[
0
][
s
->
qscale
],
15
)
<
0
){
return
-
1
;
return
-
1
;
}
}
}
}
...
@@ -973,7 +973,7 @@ decode_intra_mb:
...
@@ -973,7 +973,7 @@ decode_intra_mb:
for
(
i8x8
=
0
;
i8x8
<
4
;
i8x8
++
){
for
(
i8x8
=
0
;
i8x8
<
4
;
i8x8
++
){
if
(
cbp
&
(
1
<<
i8x8
)){
if
(
cbp
&
(
1
<<
i8x8
)){
if
(
IS_8x8DCT
(
mb_type
)){
if
(
IS_8x8DCT
(
mb_type
)){
DCTELEM
*
buf
=
&
h
->
mb
[
64
*
i8x8
*
h
->
pixel_size
];
DCTELEM
*
buf
=
&
h
->
mb
[
64
*
i8x8
<<
h
->
pixel_shift
];
uint8_t
*
nnz
;
uint8_t
*
nnz
;
for
(
i4x4
=
0
;
i4x4
<
4
;
i4x4
++
){
for
(
i4x4
=
0
;
i4x4
<
4
;
i4x4
++
){
if
(
decode_residual
(
h
,
gb
,
buf
,
i4x4
+
4
*
i8x8
,
scan8x8
+
16
*
i4x4
,
if
(
decode_residual
(
h
,
gb
,
buf
,
i4x4
+
4
*
i8x8
,
scan8x8
+
16
*
i4x4
,
...
@@ -986,7 +986,7 @@ decode_intra_mb:
...
@@ -986,7 +986,7 @@ decode_intra_mb:
for
(
i4x4
=
0
;
i4x4
<
4
;
i4x4
++
){
for
(
i4x4
=
0
;
i4x4
<
4
;
i4x4
++
){
const
int
index
=
i4x4
+
4
*
i8x8
;
const
int
index
=
i4x4
+
4
*
i8x8
;
if
(
decode_residual
(
h
,
gb
,
h
->
mb
+
16
*
index
*
h
->
pixel_size
,
index
,
scan
,
h
->
dequant4_coeff
[
IS_INTRA
(
mb_type
)
?
0
:
3
][
s
->
qscale
],
16
)
<
0
){
if
(
decode_residual
(
h
,
gb
,
h
->
mb
+
(
16
*
index
<<
h
->
pixel_shift
)
,
index
,
scan
,
h
->
dequant4_coeff
[
IS_INTRA
(
mb_type
)
?
0
:
3
][
s
->
qscale
],
16
)
<
0
){
return
-
1
;
return
-
1
;
}
}
}
}
...
@@ -1000,7 +1000,7 @@ decode_intra_mb:
...
@@ -1000,7 +1000,7 @@ decode_intra_mb:
if
(
cbp
&
0x30
){
if
(
cbp
&
0x30
){
for
(
chroma_idx
=
0
;
chroma_idx
<
2
;
chroma_idx
++
)
for
(
chroma_idx
=
0
;
chroma_idx
<
2
;
chroma_idx
++
)
if
(
decode_residual
(
h
,
gb
,
h
->
mb
+
(
256
+
16
*
4
*
chroma_idx
)
*
h
->
pixel_size
,
CHROMA_DC_BLOCK_INDEX
+
chroma_idx
,
chroma_dc_scan
,
NULL
,
4
)
<
0
){
if
(
decode_residual
(
h
,
gb
,
h
->
mb
+
(
(
256
+
16
*
4
*
chroma_idx
)
<<
h
->
pixel_shift
)
,
CHROMA_DC_BLOCK_INDEX
+
chroma_idx
,
chroma_dc_scan
,
NULL
,
4
)
<
0
){
return
-
1
;
return
-
1
;
}
}
}
}
...
@@ -1010,7 +1010,7 @@ decode_intra_mb:
...
@@ -1010,7 +1010,7 @@ decode_intra_mb:
const
uint32_t
*
qmul
=
h
->
dequant4_coeff
[
chroma_idx
+
1
+
(
IS_INTRA
(
mb_type
)
?
0
:
3
)][
h
->
chroma_qp
[
chroma_idx
]];
const
uint32_t
*
qmul
=
h
->
dequant4_coeff
[
chroma_idx
+
1
+
(
IS_INTRA
(
mb_type
)
?
0
:
3
)][
h
->
chroma_qp
[
chroma_idx
]];
for
(
i4x4
=
0
;
i4x4
<
4
;
i4x4
++
){
for
(
i4x4
=
0
;
i4x4
<
4
;
i4x4
++
){
const
int
index
=
16
+
4
*
chroma_idx
+
i4x4
;
const
int
index
=
16
+
4
*
chroma_idx
+
i4x4
;
if
(
decode_residual
(
h
,
gb
,
h
->
mb
+
16
*
index
*
h
->
pixel_size
,
index
,
scan
+
1
,
qmul
,
15
)
<
0
){
if
(
decode_residual
(
h
,
gb
,
h
->
mb
+
(
16
*
index
<<
h
->
pixel_shift
)
,
index
,
scan
+
1
,
qmul
,
15
)
<
0
){
return
-
1
;
return
-
1
;
}
}
}
}
...
...
libavcodec/h264_loopfilter.c
View file @
e7077f5e
...
@@ -650,10 +650,10 @@ static av_always_inline void filter_mb_dir(H264Context *h, int mb_x, int mb_y, u
...
@@ -650,10 +650,10 @@ static av_always_inline void filter_mb_dir(H264Context *h, int mb_x, int mb_y, u
tprintf
(
s
->
avctx
,
"filter mb:%d/%d dir:%d edge:%d, QPy:%d ls:%d uvls:%d"
,
mb_x
,
mb_y
,
dir
,
edge
,
qp
,
linesize
,
uvlinesize
);
tprintf
(
s
->
avctx
,
"filter mb:%d/%d dir:%d edge:%d, QPy:%d ls:%d uvls:%d"
,
mb_x
,
mb_y
,
dir
,
edge
,
qp
,
linesize
,
uvlinesize
);
//{ int i; for (i = 0; i < 4; i++) tprintf(s->avctx, " bS[%d]:%d", i, bS[i]); tprintf(s->avctx, "\n"); }
//{ int i; for (i = 0; i < 4; i++) tprintf(s->avctx, " bS[%d]:%d", i, bS[i]); tprintf(s->avctx, "\n"); }
if
(
dir
==
0
)
{
if
(
dir
==
0
)
{
filter_mb_edgev
(
&
img_y
[
4
*
edge
*
h
->
pixel_size
],
linesize
,
bS
,
qp
,
h
);
filter_mb_edgev
(
&
img_y
[
4
*
edge
<<
h
->
pixel_shift
],
linesize
,
bS
,
qp
,
h
);
if
(
(
edge
&
1
)
==
0
)
{
if
(
(
edge
&
1
)
==
0
)
{
filter_mb_edgecv
(
&
img_cb
[
2
*
edge
*
h
->
pixel_size
],
uvlinesize
,
bS
,
h
->
chroma_qp
[
0
],
h
);
filter_mb_edgecv
(
&
img_cb
[
2
*
edge
<<
h
->
pixel_shift
],
uvlinesize
,
bS
,
h
->
chroma_qp
[
0
],
h
);
filter_mb_edgecv
(
&
img_cr
[
2
*
edge
*
h
->
pixel_size
],
uvlinesize
,
bS
,
h
->
chroma_qp
[
1
],
h
);
filter_mb_edgecv
(
&
img_cr
[
2
*
edge
<<
h
->
pixel_shift
],
uvlinesize
,
bS
,
h
->
chroma_qp
[
1
],
h
);
}
}
}
else
{
}
else
{
filter_mb_edgeh
(
&
img_y
[
4
*
edge
*
linesize
],
linesize
,
bS
,
qp
,
h
);
filter_mb_edgeh
(
&
img_y
[
4
*
edge
*
linesize
],
linesize
,
bS
,
qp
,
h
);
...
...
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