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
d0540fd0
Commit
d0540fd0
authored
Feb 20, 2016
by
Vittorio Giovara
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
intrax8: Pass macroblock size to ff_intrax8_common_init
Helps in decoupling this code from mpegvideo.
parent
9f4d9913
Show whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
23 additions
and
9 deletions
+23
-9
intrax8.c
libavcodec/intrax8.c
+11
-7
intrax8.h
libavcodec/intrax8.h
+7
-0
vc1dec.c
libavcodec/vc1dec.c
+3
-1
wmv2dec.c
libavcodec/wmv2dec.c
+2
-1
No files found.
libavcodec/intrax8.c
View file @
d0540fd0
...
@@ -399,7 +399,7 @@ static void x8_get_prediction_chroma(IntraX8Context *const w)
...
@@ -399,7 +399,7 @@ static void x8_get_prediction_chroma(IntraX8Context *const w)
w
->
edges
=
1
*
(
!
(
s
->
mb_x
>>
1
));
w
->
edges
=
1
*
(
!
(
s
->
mb_x
>>
1
));
w
->
edges
|=
2
*
(
!
(
s
->
mb_y
>>
1
));
w
->
edges
|=
2
*
(
!
(
s
->
mb_y
>>
1
));
w
->
edges
|=
4
*
(
s
->
mb_x
>=
(
2
*
s
->
mb_width
-
1
));
// mb_x for chroma would always be odd
w
->
edges
|=
4
*
(
s
->
mb_x
>=
(
2
*
w
->
mb_width
-
1
));
// mb_x for chroma would always be odd
w
->
raw_orient
=
0
;
w
->
raw_orient
=
0
;
// lut_co[8] = {inv,4,8,8, inv,4,8,8} <- => {1,1,0,0;1,1,0,0} => 0xCC
// lut_co[8] = {inv,4,8,8, inv,4,8,8} <- => {1,1,0,0;1,1,0,0} => 0xCC
...
@@ -418,7 +418,7 @@ static void x8_get_prediction(IntraX8Context *const w)
...
@@ -418,7 +418,7 @@ static void x8_get_prediction(IntraX8Context *const w)
w
->
edges
=
1
*
(
!
s
->
mb_x
);
w
->
edges
=
1
*
(
!
s
->
mb_x
);
w
->
edges
|=
2
*
(
!
s
->
mb_y
);
w
->
edges
|=
2
*
(
!
s
->
mb_y
);
w
->
edges
|=
4
*
(
s
->
mb_x
>=
(
2
*
s
->
mb_width
-
1
));
w
->
edges
|=
4
*
(
s
->
mb_x
>=
(
2
*
w
->
mb_width
-
1
));
switch
(
w
->
edges
&
3
)
{
switch
(
w
->
edges
&
3
)
{
case
0
:
case
0
:
...
@@ -739,6 +739,7 @@ static void x8_init_block_index(IntraX8Context *w, AVFrame *frame, int mb_y)
...
@@ -739,6 +739,7 @@ static void x8_init_block_index(IntraX8Context *w, AVFrame *frame, int mb_y)
av_cold
int
ff_intrax8_common_init
(
AVCodecContext
*
avctx
,
av_cold
int
ff_intrax8_common_init
(
AVCodecContext
*
avctx
,
IntraX8Context
*
w
,
IDCTDSPContext
*
idsp
,
IntraX8Context
*
w
,
IDCTDSPContext
*
idsp
,
int
mb_width
,
int
mb_height
,
MpegEncContext
*
const
s
)
MpegEncContext
*
const
s
)
{
{
int
ret
=
x8_vlc_init
();
int
ret
=
x8_vlc_init
();
...
@@ -747,10 +748,14 @@ av_cold int ff_intrax8_common_init(AVCodecContext *avctx,
...
@@ -747,10 +748,14 @@ av_cold int ff_intrax8_common_init(AVCodecContext *avctx,
w
->
avctx
=
avctx
;
w
->
avctx
=
avctx
;
w
->
idsp
=
*
idsp
;
w
->
idsp
=
*
idsp
;
s
->
mb_x
=
0
;
s
->
mb_y
=
0
;
w
->
mb_width
=
mb_width
;
w
->
mb_height
=
mb_height
;
w
->
s
=
s
;
w
->
s
=
s
;
// two rows, 2 blocks per cannon mb
// two rows, 2 blocks per cannon mb
w
->
prediction_table
=
av_mallocz
(
s
->
mb_width
*
2
*
2
);
w
->
prediction_table
=
av_mallocz
(
w
->
mb_width
*
2
*
2
);
if
(
!
w
->
prediction_table
)
if
(
!
w
->
prediction_table
)
return
AVERROR
(
ENOMEM
);
return
AVERROR
(
ENOMEM
);
...
@@ -798,11 +803,10 @@ int ff_intrax8_decode_picture(IntraX8Context *const w, Picture *pict,
...
@@ -798,11 +803,10 @@ int ff_intrax8_decode_picture(IntraX8Context *const w, Picture *pict,
}
}
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
<
w
->
mb_height
*
2
;
s
->
mb_y
++
)
{
x8_init_block_index
(
w
,
w
->
frame
,
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
)
*
(
w
->
mb_width
+
1
);
for
(
s
->
mb_x
=
0
;
s
->
mb_x
<
w
->
mb_width
*
2
;
s
->
mb_x
++
)
{
for
(
s
->
mb_x
=
0
;
s
->
mb_x
<
s
->
mb_width
*
2
;
s
->
mb_x
++
)
{
x8_get_prediction
(
w
);
x8_get_prediction
(
w
);
if
(
x8_setup_spatial_predictor
(
w
,
0
))
if
(
x8_setup_spatial_predictor
(
w
,
0
))
goto
error
;
goto
error
;
...
...
libavcodec/intrax8.h
View file @
d0540fd0
...
@@ -65,6 +65,10 @@ typedef struct IntraX8Context {
...
@@ -65,6 +65,10 @@ typedef struct IntraX8Context {
int
chroma_orient
;
int
chroma_orient
;
int
orient
;
int
orient
;
int
est_run
;
int
est_run
;
// block props
int
mb_x
,
mb_y
;
int
mb_width
,
mb_height
;
}
IntraX8Context
;
}
IntraX8Context
;
/**
/**
...
@@ -73,11 +77,14 @@ typedef struct IntraX8Context {
...
@@ -73,11 +77,14 @@ typedef struct IntraX8Context {
* @param avctx pointer to AVCodecContext
* @param avctx pointer to AVCodecContext
* @param w pointer to IntraX8Context
* @param w pointer to IntraX8Context
* @param idsp pointer to IDCTDSPContext
* @param idsp pointer to IDCTDSPContext
* @param mb_width macroblock width
* @param mb_height macroblock height
* @param s pointer to MpegEncContext of the parent codec
* @param s pointer to MpegEncContext of the parent codec
* @return 0 on success, a negative AVERROR value on error
* @return 0 on success, a negative AVERROR value on error
*/
*/
int
ff_intrax8_common_init
(
AVCodecContext
*
avctx
,
int
ff_intrax8_common_init
(
AVCodecContext
*
avctx
,
IntraX8Context
*
w
,
IDCTDSPContext
*
idsp
,
IntraX8Context
*
w
,
IDCTDSPContext
*
idsp
,
int
mb_width
,
int
mb_height
,
MpegEncContext
*
const
s
);
MpegEncContext
*
const
s
);
/**
/**
...
...
libavcodec/vc1dec.c
View file @
d0540fd0
...
@@ -379,7 +379,9 @@ av_cold int ff_vc1_decode_init_alloc_tables(VC1Context *v)
...
@@ -379,7 +379,9 @@ av_cold int ff_vc1_decode_init_alloc_tables(VC1Context *v)
}
}
}
}
ret
=
ff_intrax8_common_init
(
s
->
avctx
,
&
v
->
x8
,
&
s
->
idsp
,
s
);
ret
=
ff_intrax8_common_init
(
s
->
avctx
,
&
v
->
x8
,
&
s
->
idsp
,
s
->
mb_width
,
s
->
mb_height
,
s
);
if
(
ret
<
0
)
if
(
ret
<
0
)
goto
error
;
goto
error
;
...
...
libavcodec/wmv2dec.c
View file @
d0540fd0
...
@@ -473,7 +473,8 @@ static av_cold int wmv2_decode_init(AVCodecContext *avctx)
...
@@ -473,7 +473,8 @@ static av_cold int wmv2_decode_init(AVCodecContext *avctx)
ff_wmv2_common_init
(
w
);
ff_wmv2_common_init
(
w
);
return
ff_intrax8_common_init
(
avctx
,
&
w
->
x8
,
&
w
->
s
.
idsp
,
&
w
->
s
);
return
ff_intrax8_common_init
(
avctx
,
&
w
->
x8
,
&
w
->
s
.
idsp
,
w
->
s
.
mb_width
,
w
->
s
.
mb_height
,
&
w
->
s
);
}
}
static
av_cold
int
wmv2_decode_end
(
AVCodecContext
*
avctx
)
static
av_cold
int
wmv2_decode_end
(
AVCodecContext
*
avctx
)
...
...
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