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
7873f9aa
Commit
7873f9aa
authored
Jan 20, 2015
by
Michael Niedermayer
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
avcodec/snowdec: AVMotionVector support
Signed-off-by:
Michael Niedermayer
<
michaelni@gmx.at
>
parent
e069a4bf
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
41 additions
and
0 deletions
+41
-0
snow.h
libavcodec/snow.h
+5
-0
snowdec.c
libavcodec/snowdec.c
+36
-0
No files found.
libavcodec/snow.h
View file @
7873f9aa
...
@@ -22,6 +22,8 @@
...
@@ -22,6 +22,8 @@
#ifndef AVCODEC_SNOW_H
#ifndef AVCODEC_SNOW_H
#define AVCODEC_SNOW_H
#define AVCODEC_SNOW_H
#include "libavutil/motion_vector.h"
#include "hpeldsp.h"
#include "hpeldsp.h"
#include "me_cmp.h"
#include "me_cmp.h"
#include "qpeldsp.h"
#include "qpeldsp.h"
...
@@ -178,6 +180,9 @@ typedef struct SnowContext{
...
@@ -178,6 +180,9 @@ typedef struct SnowContext{
uint8_t
*
scratchbuf
;
uint8_t
*
scratchbuf
;
uint8_t
*
emu_edge_buffer
;
uint8_t
*
emu_edge_buffer
;
AVMotionVector
*
avmv
;
int
avmv_index
;
}
SnowContext
;
}
SnowContext
;
/* Tables */
/* Tables */
...
...
libavcodec/snowdec.c
View file @
7873f9aa
...
@@ -87,6 +87,26 @@ static av_always_inline void predict_slice_buffered(SnowContext *s, slice_buffer
...
@@ -87,6 +87,26 @@ static av_always_inline void predict_slice_buffered(SnowContext *s, slice_buffer
mb_x
-
1
,
mb_y
-
1
,
mb_x
-
1
,
mb_y
-
1
,
add
,
0
,
plane_index
);
add
,
0
,
plane_index
);
}
}
if
(
s
->
avmv
&&
mb_y
<
mb_h
&&
plane_index
==
0
)
for
(
mb_x
=
0
;
mb_x
<
mb_w
;
mb_x
++
){
AVMotionVector
*
avmv
=
s
->
avmv
+
(
s
->
avmv_index
++
);
const
int
b_width
=
s
->
b_width
<<
s
->
block_max_depth
;
const
int
b_stride
=
b_width
;
BlockNode
*
bn
=
&
s
->
block
[
mb_x
+
mb_y
*
b_stride
];
if
(
bn
->
type
)
continue
;
avmv
->
w
=
block_w
;
avmv
->
h
=
block_h
;
avmv
->
dst_x
=
block_w
*
mb_x
-
block_w
/
2
;
avmv
->
dst_y
=
block_h
*
mb_y
-
block_h
/
2
;
avmv
->
src_x
=
avmv
->
dst_x
+
(
bn
->
mx
*
s
->
mv_scale
)
/
8
;
avmv
->
src_y
=
avmv
->
dst_y
+
(
bn
->
my
*
s
->
mv_scale
)
/
8
;
avmv
->
source
=
-
1
-
bn
->
ref
;
avmv
->
flags
=
0
;
}
}
}
static
inline
void
decode_subband_slice_buffered
(
SnowContext
*
s
,
SubBand
*
b
,
slice_buffer
*
sb
,
int
start_y
,
int
h
,
int
save_state
[
1
]){
static
inline
void
decode_subband_slice_buffered
(
SnowContext
*
s
,
SubBand
*
b
,
slice_buffer
*
sb
,
int
start_y
,
int
h
,
int
save_state
[
1
]){
...
@@ -455,6 +475,12 @@ static int decode_frame(AVCodecContext *avctx, void *data, int *got_frame,
...
@@ -455,6 +475,12 @@ static int decode_frame(AVCodecContext *avctx, void *data, int *got_frame,
s
->
spatial_decomposition_count
s
->
spatial_decomposition_count
);
);
av_assert0
(
!
s
->
avmv
);
if
(
s
->
avctx
->
flags2
&
CODEC_FLAG2_EXPORT_MVS
)
{
s
->
avmv
=
av_malloc_array
(
s
->
b_width
*
s
->
b_height
,
sizeof
(
AVMotionVector
)
<<
(
s
->
block_max_depth
*
2
));
}
s
->
avmv_index
=
0
;
if
((
res
=
decode_blocks
(
s
))
<
0
)
if
((
res
=
decode_blocks
(
s
))
<
0
)
return
res
;
return
res
;
...
@@ -573,6 +599,16 @@ static int decode_frame(AVCodecContext *avctx, void *data, int *got_frame,
...
@@ -573,6 +599,16 @@ static int decode_frame(AVCodecContext *avctx, void *data, int *got_frame,
res
=
av_frame_ref
(
picture
,
s
->
current_picture
);
res
=
av_frame_ref
(
picture
,
s
->
current_picture
);
else
else
res
=
av_frame_ref
(
picture
,
s
->
mconly_picture
);
res
=
av_frame_ref
(
picture
,
s
->
mconly_picture
);
if
(
res
>=
0
&&
s
->
avmv_index
)
{
AVFrameSideData
*
sd
;
sd
=
av_frame_new_side_data
(
picture
,
AV_FRAME_DATA_MOTION_VECTORS
,
s
->
avmv_index
*
sizeof
(
AVMotionVector
));
if
(
!
sd
)
return
AVERROR
(
ENOMEM
);
memcpy
(
sd
->
data
,
s
->
avmv
,
s
->
avmv_index
*
sizeof
(
AVMotionVector
));
}
av_freep
(
&
s
->
avmv
);
if
(
res
<
0
)
if
(
res
<
0
)
return
res
;
return
res
;
...
...
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