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
eaeba6f2
Commit
eaeba6f2
authored
Feb 20, 2016
by
Vittorio Giovara
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
intrax8: Pass the output frame to the decoding function
Helps in decoupling this code from mpegvideo.
parent
57739332
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
21 additions
and
15 deletions
+21
-15
intrax8.c
libavcodec/intrax8.c
+11
-10
intrax8.h
libavcodec/intrax8.h
+5
-2
vc1_block.c
libavcodec/vc1_block.c
+3
-2
wmv2dec.c
libavcodec/wmv2dec.c
+2
-1
No files found.
libavcodec/intrax8.c
View file @
eaeba6f2
...
@@ -336,7 +336,7 @@ static int x8_setup_spatial_predictor(IntraX8Context *const w, const int chroma)
...
@@ -336,7 +336,7 @@ static int x8_setup_spatial_predictor(IntraX8Context *const w, const int chroma)
int
quant
;
int
quant
;
w
->
dsp
.
setup_spatial_compensation
(
w
->
dest
[
chroma
],
s
->
sc
.
edge_emu_buffer
,
w
->
dsp
.
setup_spatial_compensation
(
w
->
dest
[
chroma
],
s
->
sc
.
edge_emu_buffer
,
s
->
current_picture
.
f
->
linesize
[
chroma
>
0
],
w
->
frame
->
linesize
[
chroma
>
0
],
&
range
,
&
sum
,
w
->
edges
);
&
range
,
&
sum
,
w
->
edges
);
if
(
chroma
)
{
if
(
chroma
)
{
w
->
orient
=
w
->
chroma_orient
;
w
->
orient
=
w
->
chroma_orient
;
...
@@ -672,7 +672,7 @@ static int x8_decode_intra_mb(IntraX8Context *const w, const int chroma)
...
@@ -672,7 +672,7 @@ static int x8_decode_intra_mb(IntraX8Context *const w, const int chroma)
dsp_x8_put_solidcolor
(
av_clip_uint8
((
dc_level
*
dc_quant
+
4
)
>>
3
),
dsp_x8_put_solidcolor
(
av_clip_uint8
((
dc_level
*
dc_quant
+
4
)
>>
3
),
w
->
dest
[
chroma
],
w
->
dest
[
chroma
],
s
->
current_picture
.
f
->
linesize
[
!!
chroma
]);
w
->
frame
->
linesize
[
!!
chroma
]);
goto
block_placed
;
goto
block_placed
;
}
}
...
@@ -697,15 +697,15 @@ static int x8_decode_intra_mb(IntraX8Context *const w, const int chroma)
...
@@ -697,15 +697,15 @@ static int x8_decode_intra_mb(IntraX8Context *const w, const int chroma)
if
(
w
->
flat_dc
)
{
if
(
w
->
flat_dc
)
{
dsp_x8_put_solidcolor
(
w
->
predicted_dc
,
w
->
dest
[
chroma
],
dsp_x8_put_solidcolor
(
w
->
predicted_dc
,
w
->
dest
[
chroma
],
s
->
current_picture
.
f
->
linesize
[
!!
chroma
]);
w
->
frame
->
linesize
[
!!
chroma
]);
}
else
{
}
else
{
w
->
dsp
.
spatial_compensation
[
w
->
orient
](
s
->
sc
.
edge_emu_buffer
,
w
->
dsp
.
spatial_compensation
[
w
->
orient
](
s
->
sc
.
edge_emu_buffer
,
w
->
dest
[
chroma
],
w
->
dest
[
chroma
],
s
->
current_picture
.
f
->
linesize
[
!!
chroma
]);
w
->
frame
->
linesize
[
!!
chroma
]);
}
}
if
(
!
zeros_only
)
if
(
!
zeros_only
)
w
->
idsp
.
idct_add
(
w
->
dest
[
chroma
],
w
->
idsp
.
idct_add
(
w
->
dest
[
chroma
],
s
->
current_picture
.
f
->
linesize
[
!!
chroma
],
w
->
frame
->
linesize
[
!!
chroma
],
s
->
block
[
0
]);
s
->
block
[
0
]);
block_placed:
block_placed:
...
@@ -714,7 +714,7 @@ block_placed:
...
@@ -714,7 +714,7 @@ block_placed:
if
(
w
->
loopfilter
)
{
if
(
w
->
loopfilter
)
{
uint8_t
*
ptr
=
w
->
dest
[
chroma
];
uint8_t
*
ptr
=
w
->
dest
[
chroma
];
int
linesize
=
s
->
current_picture
.
f
->
linesize
[
!!
chroma
];
int
linesize
=
w
->
frame
->
linesize
[
!!
chroma
];
if
(
!
((
w
->
edges
&
2
)
||
(
zeros_only
&&
(
w
->
orient
|
4
)
==
4
)))
if
(
!
((
w
->
edges
&
2
)
||
(
zeros_only
&&
(
w
->
orient
|
4
)
==
4
)))
w
->
dsp
.
h_loop_filter
(
ptr
,
linesize
,
w
->
quant
);
w
->
dsp
.
h_loop_filter
(
ptr
,
linesize
,
w
->
quant
);
...
@@ -775,8 +775,8 @@ av_cold void ff_intrax8_common_end(IntraX8Context *w)
...
@@ -775,8 +775,8 @@ av_cold void ff_intrax8_common_end(IntraX8Context *w)
av_freep
(
&
w
->
prediction_table
);
av_freep
(
&
w
->
prediction_table
);
}
}
int
ff_intrax8_decode_picture
(
IntraX8Context
*
const
w
,
int
dquan
t
,
int
ff_intrax8_decode_picture
(
IntraX8Context
*
const
w
,
Picture
*
pic
t
,
int
quant_offset
,
int
loopfilter
)
int
dquant
,
int
quant_offset
,
int
loopfilter
)
{
{
MpegEncContext
*
const
s
=
w
->
s
;
MpegEncContext
*
const
s
=
w
->
s
;
int
mb_xy
;
int
mb_xy
;
...
@@ -786,6 +786,7 @@ int ff_intrax8_decode_picture(IntraX8Context *const w, int dquant,
...
@@ -786,6 +786,7 @@ int ff_intrax8_decode_picture(IntraX8Context *const w, int dquant,
w
->
dquant
=
dquant
;
w
->
dquant
=
dquant
;
w
->
quant
=
dquant
>>
1
;
w
->
quant
=
dquant
>>
1
;
w
->
qsum
=
quant_offset
;
w
->
qsum
=
quant_offset
;
w
->
frame
=
pict
->
f
;
w
->
loopfilter
=
loopfilter
;
w
->
loopfilter
=
loopfilter
;
w
->
divide_quant_dc_luma
=
((
1
<<
16
)
+
(
w
->
quant
>>
1
))
/
w
->
quant
;
w
->
divide_quant_dc_luma
=
((
1
<<
16
)
+
(
w
->
quant
>>
1
))
/
w
->
quant
;
...
@@ -799,7 +800,7 @@ int ff_intrax8_decode_picture(IntraX8Context *const w, int dquant,
...
@@ -799,7 +800,7 @@ int ff_intrax8_decode_picture(IntraX8Context *const w, int dquant,
x8_reset_vlc_tables
(
w
);
x8_reset_vlc_tables
(
w
);
for
(
s
->
mb_y
=
0
;
s
->
mb_y
<
s
->
mb_height
*
2
;
s
->
mb_y
++
)
{
for
(
s
->
mb_y
=
0
;
s
->
mb_y
<
s
->
mb_height
*
2
;
s
->
mb_y
++
)
{
x8_init_block_index
(
w
,
s
->
current_picture
.
f
,
s
->
mb_y
);
x8_init_block_index
(
w
,
w
->
frame
,
s
->
mb_y
);
mb_xy
=
(
s
->
mb_y
>>
1
)
*
s
->
mb_stride
;
mb_xy
=
(
s
->
mb_y
>>
1
)
*
s
->
mb_stride
;
for
(
s
->
mb_x
=
0
;
s
->
mb_x
<
s
->
mb_width
*
2
;
s
->
mb_x
++
)
{
for
(
s
->
mb_x
=
0
;
s
->
mb_x
<
s
->
mb_width
*
2
;
s
->
mb_x
++
)
{
...
@@ -828,7 +829,7 @@ int ff_intrax8_decode_picture(IntraX8Context *const w, int dquant,
...
@@ -828,7 +829,7 @@ int ff_intrax8_decode_picture(IntraX8Context *const w, int dquant,
/* emulate MB info in the relevant tables */
/* emulate MB info in the relevant tables */
s
->
mbskip_table
[
mb_xy
]
=
0
;
s
->
mbskip_table
[
mb_xy
]
=
0
;
s
->
mbintra_table
[
mb_xy
]
=
1
;
s
->
mbintra_table
[
mb_xy
]
=
1
;
s
->
current_picture
.
qscale_table
[
mb_xy
]
=
w
->
quant
;
pict
->
qscale_table
[
mb_xy
]
=
w
->
quant
;
mb_xy
++
;
mb_xy
++
;
}
}
w
->
dest
[
0
]
+=
8
;
w
->
dest
[
0
]
+=
8
;
...
...
libavcodec/intrax8.h
View file @
eaeba6f2
...
@@ -23,6 +23,7 @@
...
@@ -23,6 +23,7 @@
#include "mpegvideo.h"
#include "mpegvideo.h"
#include "idctdsp.h"
#include "idctdsp.h"
#include "intrax8dsp.h"
#include "intrax8dsp.h"
#include "mpegpicture.h"
typedef
struct
IntraX8Context
{
typedef
struct
IntraX8Context
{
VLC
*
j_ac_vlc
[
4
];
// they point to the static j_mb_vlc
VLC
*
j_ac_vlc
[
4
];
// they point to the static j_mb_vlc
...
@@ -43,6 +44,7 @@ typedef struct IntraX8Context {
...
@@ -43,6 +44,7 @@ typedef struct IntraX8Context {
int
dquant
;
int
dquant
;
int
qsum
;
int
qsum
;
int
loopfilter
;
int
loopfilter
;
AVFrame
*
frame
;
// calculated per frame
// calculated per frame
int
quant_dc_chroma
;
int
quant_dc_chroma
;
...
@@ -84,11 +86,12 @@ void ff_intrax8_common_end(IntraX8Context *w);
...
@@ -84,11 +86,12 @@ void ff_intrax8_common_end(IntraX8Context *w);
* The parent codec must call ff_mpv_frame_end() after calling this function.
* The parent codec must call ff_mpv_frame_end() after calling this function.
* This function does not use ff_mpv_decode_mb().
* This function does not use ff_mpv_decode_mb().
* @param w pointer to IntraX8Context
* @param w pointer to IntraX8Context
* @param pict the output Picture containing an AVFrame
* @param dquant doubled quantizer, it would be odd in case of VC-1 halfpq==1.
* @param dquant doubled quantizer, it would be odd in case of VC-1 halfpq==1.
* @param quant_offset offset away from zero
* @param quant_offset offset away from zero
* @param loopfilter enable filter after decoding a block
* @param loopfilter enable filter after decoding a block
*/
*/
int
ff_intrax8_decode_picture
(
IntraX8Context
*
w
,
int
quant
,
int
halfpq
,
int
ff_intrax8_decode_picture
(
IntraX8Context
*
w
,
Picture
*
pict
,
int
loopfilter
);
int
quant
,
int
halfpq
,
int
loopfilter
);
#endif
/* AVCODEC_INTRAX8_H */
#endif
/* AVCODEC_INTRAX8_H */
libavcodec/vc1_block.c
View file @
eaeba6f2
...
@@ -3022,8 +3022,9 @@ void ff_vc1_decode_blocks(VC1Context *v)
...
@@ -3022,8 +3022,9 @@ void ff_vc1_decode_blocks(VC1Context *v)
v
->
s
.
esc3_level_length
=
0
;
v
->
s
.
esc3_level_length
=
0
;
if
(
v
->
x8_type
)
{
if
(
v
->
x8_type
)
{
ff_intrax8_decode_picture
(
&
v
->
x8
,
2
*
v
->
pq
+
v
->
halfpq
,
ff_intrax8_decode_picture
(
&
v
->
x8
,
&
v
->
s
.
current_picture
,
v
->
pq
*
!
v
->
pquantizer
,
v
->
s
.
loop_filter
);
2
*
v
->
pq
+
v
->
halfpq
,
v
->
pq
*
!
v
->
pquantizer
,
v
->
s
.
loop_filter
);
ff_er_add_slice
(
&
v
->
s
.
er
,
0
,
0
,
ff_er_add_slice
(
&
v
->
s
.
er
,
0
,
0
,
(
v
->
s
.
mb_x
>>
1
)
-
1
,
(
v
->
s
.
mb_y
>>
1
)
-
1
,
(
v
->
s
.
mb_x
>>
1
)
-
1
,
(
v
->
s
.
mb_y
>>
1
)
-
1
,
...
...
libavcodec/wmv2dec.c
View file @
eaeba6f2
...
@@ -228,7 +228,8 @@ int ff_wmv2_decode_secondary_picture_header(MpegEncContext *s)
...
@@ -228,7 +228,8 @@ int ff_wmv2_decode_secondary_picture_header(MpegEncContext *s)
s
->
picture_number
++
;
// FIXME ?
s
->
picture_number
++
;
// FIXME ?
if
(
w
->
j_type
)
{
if
(
w
->
j_type
)
{
ff_intrax8_decode_picture
(
&
w
->
x8
,
2
*
s
->
qscale
,
(
s
->
qscale
-
1
)
|
1
,
ff_intrax8_decode_picture
(
&
w
->
x8
,
&
s
->
current_picture
,
2
*
s
->
qscale
,
(
s
->
qscale
-
1
)
|
1
,
s
->
loop_filter
);
s
->
loop_filter
);
ff_er_add_slice
(
&
w
->
s
.
er
,
0
,
0
,
ff_er_add_slice
(
&
w
->
s
.
er
,
0
,
0
,
...
...
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