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
b96c9513
Commit
b96c9513
authored
Jun 27, 2014
by
Michael Niedermayer
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
avcodec/snow: factor ff_snow_get_buffer() out
Signed-off-by:
Michael Niedermayer
<
michaelni@gmx.at
>
parent
134beb9e
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
24 additions
and
22 deletions
+24
-22
snow.c
libavcodec/snow.c
+21
-11
snow.h
libavcodec/snow.h
+1
-0
snowenc.c
libavcodec/snowenc.c
+2
-11
No files found.
libavcodec/snow.c
View file @
b96c9513
...
...
@@ -66,6 +66,26 @@ void ff_snow_inner_add_yblock(const uint8_t *obmc, const int obmc_stride, uint8_
}
}
int
ff_snow_get_buffer
(
SnowContext
*
s
,
AVFrame
*
frame
)
{
int
ret
,
i
;
frame
->
width
=
s
->
avctx
->
width
+
2
*
EDGE_WIDTH
;
frame
->
height
=
s
->
avctx
->
height
+
2
*
EDGE_WIDTH
;
if
((
ret
=
ff_get_buffer
(
s
->
avctx
,
frame
,
AV_GET_BUFFER_FLAG_REF
))
<
0
)
return
ret
;
for
(
i
=
0
;
frame
->
data
[
i
];
i
++
)
{
int
offset
=
(
EDGE_WIDTH
>>
(
i
?
s
->
chroma_v_shift
:
0
))
*
frame
->
linesize
[
i
]
+
(
EDGE_WIDTH
>>
(
i
?
s
->
chroma_h_shift
:
0
));
frame
->
data
[
i
]
+=
offset
;
}
frame
->
width
=
s
->
avctx
->
width
;
frame
->
height
=
s
->
avctx
->
height
;
return
0
;
}
void
ff_snow_reset_contexts
(
SnowContext
*
s
){
//FIXME better initial contexts
int
plane_index
,
level
,
orientation
;
...
...
@@ -661,18 +681,8 @@ int ff_snow_frame_start(SnowContext *s){
return
-
1
;
}
}
s
->
current_picture
->
width
=
s
->
avctx
->
width
+
2
*
EDGE_WIDTH
;
s
->
current_picture
->
height
=
s
->
avctx
->
height
+
2
*
EDGE_WIDTH
;
if
((
ret
=
ff_get_buffer
(
s
->
avctx
,
s
->
current_picture
,
AV_GET_BUFFER_FLAG_REF
))
<
0
)
if
((
ret
=
ff_snow_get_buffer
(
s
,
s
->
current_picture
))
<
0
)
return
ret
;
for
(
i
=
0
;
s
->
current_picture
->
data
[
i
];
i
++
)
{
int
offset
=
(
EDGE_WIDTH
>>
(
i
?
s
->
chroma_v_shift
:
0
))
*
s
->
current_picture
->
linesize
[
i
]
+
(
EDGE_WIDTH
>>
(
i
?
s
->
chroma_h_shift
:
0
));
s
->
current_picture
->
data
[
i
]
+=
offset
;
}
s
->
current_picture
->
width
=
s
->
avctx
->
width
;
s
->
current_picture
->
height
=
s
->
avctx
->
height
;
s
->
current_picture
->
key_frame
=
s
->
keyframe
;
...
...
libavcodec/snow.h
View file @
b96c9513
...
...
@@ -232,6 +232,7 @@ int ff_snow_frame_start(SnowContext *s);
void
ff_snow_pred_block
(
SnowContext
*
s
,
uint8_t
*
dst
,
uint8_t
*
tmp
,
ptrdiff_t
stride
,
int
sx
,
int
sy
,
int
b_w
,
int
b_h
,
BlockNode
*
block
,
int
plane_index
,
int
w
,
int
h
);
int
ff_snow_get_buffer
(
SnowContext
*
s
,
AVFrame
*
frame
);
/* common inline functions */
//XXX doublecheck all of them should stay inlined
...
...
libavcodec/snowenc.c
View file @
b96c9513
...
...
@@ -125,18 +125,9 @@ static av_cold int encode_init(AVCodecContext *avctx)
s
->
input_picture
=
av_frame_alloc
();
if
(
!
s
->
input_picture
)
return
AVERROR
(
ENOMEM
);
s
->
input_picture
->
width
=
s
->
avctx
->
width
+
2
*
EDGE_WIDTH
;
s
->
input_picture
->
height
=
s
->
avctx
->
height
+
2
*
EDGE_WIDTH
;
if
((
ret
=
ff_get_buffer
(
s
->
avctx
,
s
->
input_picture
,
AV_GET_BUFFER_FLAG_REF
))
<
0
)
if
((
ret
=
ff_snow_get_buffer
(
s
,
s
->
input_picture
))
<
0
)
return
ret
;
for
(
i
=
0
;
s
->
input_picture
->
data
[
i
];
i
++
)
{
int
offset
=
(
EDGE_WIDTH
>>
(
i
?
s
->
chroma_v_shift
:
0
))
*
s
->
input_picture
->
linesize
[
i
]
+
(
EDGE_WIDTH
>>
(
i
?
s
->
chroma_h_shift
:
0
));
s
->
input_picture
->
data
[
i
]
+=
offset
;
}
s
->
input_picture
->
width
=
s
->
avctx
->
width
;
s
->
input_picture
->
height
=
s
->
avctx
->
height
;
if
(
s
->
avctx
->
me_method
==
ME_ITER
){
int
size
=
s
->
b_width
*
s
->
b_height
<<
2
*
s
->
block_max_depth
;
...
...
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