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
5dedb2af
Commit
5dedb2af
authored
Apr 14, 2017
by
Paul B Mahol
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
avcodec/dnxhd*: add ff_dnxhd_get_hr_frame_size()
Signed-off-by:
Paul B Mahol
<
onemda@gmail.com
>
parent
34c2eea3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
16 additions
and
23 deletions
+16
-23
dnxhd_parser.c
libavcodec/dnxhd_parser.c
+1
-14
dnxhddata.h
libavcodec/dnxhddata.h
+13
-0
dnxhdenc.c
libavcodec/dnxhdenc.c
+2
-9
No files found.
libavcodec/dnxhd_parser.c
View file @
5dedb2af
...
...
@@ -36,19 +36,6 @@ typedef struct {
int
w
,
h
;
}
DNXHDParserContext
;
static
int
dnxhd_get_hr_frame_size
(
int
cid
,
int
w
,
int
h
)
{
int
result
,
i
=
ff_dnxhd_get_cid_table
(
cid
);
if
(
i
<
0
)
return
i
;
result
=
((
h
+
15
)
/
16
)
*
((
w
+
15
)
/
16
)
*
(
int64_t
)
ff_dnxhd_cid_table
[
i
].
packet_scale
.
num
/
ff_dnxhd_cid_table
[
i
].
packet_scale
.
den
;
result
=
(
result
+
2048
)
/
4096
*
4096
;
return
FFMAX
(
result
,
8192
);
}
static
int
dnxhd_find_frame_end
(
DNXHDParserContext
*
dctx
,
const
uint8_t
*
buf
,
int
buf_size
)
{
...
...
@@ -93,7 +80,7 @@ static int dnxhd_find_frame_end(DNXHDParserContext *dctx,
dctx
->
remaining
=
avpriv_dnxhd_get_frame_size
(
cid
);
if
(
dctx
->
remaining
<=
0
)
{
dctx
->
remaining
=
dnxhd_get_hr_frame_size
(
cid
,
dctx
->
w
,
dctx
->
h
);
dctx
->
remaining
=
ff_
dnxhd_get_hr_frame_size
(
cid
,
dctx
->
w
,
dctx
->
h
);
if
(
dctx
->
remaining
<=
0
)
return
dctx
->
remaining
;
}
...
...
libavcodec/dnxhddata.h
View file @
5dedb2af
...
...
@@ -91,6 +91,19 @@ static av_always_inline uint64_t ff_dnxhd_parse_header_prefix(const uint8_t *buf
return
ff_dnxhd_check_header_prefix
(
prefix
);
}
static
av_always_inline
int
ff_dnxhd_get_hr_frame_size
(
int
cid
,
int
w
,
int
h
)
{
int
result
,
i
=
ff_dnxhd_get_cid_table
(
cid
);
if
(
i
<
0
)
return
i
;
result
=
((
h
+
15
)
/
16
)
*
((
w
+
15
)
/
16
)
*
(
int64_t
)
ff_dnxhd_cid_table
[
i
].
packet_scale
.
num
/
ff_dnxhd_cid_table
[
i
].
packet_scale
.
den
;
result
=
(
result
+
2048
)
/
4096
*
4096
;
return
FFMAX
(
result
,
8192
);
}
int
avpriv_dnxhd_get_frame_size
(
int
cid
);
int
avpriv_dnxhd_get_interlaced
(
int
cid
);
#if LIBAVCODEC_VERSION_MAJOR < 58
...
...
libavcodec/dnxhdenc.c
View file @
5dedb2af
...
...
@@ -362,13 +362,6 @@ fail:
return
AVERROR
(
ENOMEM
);
}
static
int
dnxhd_get_hr_frame_size
(
const
CIDEntry
*
profile
,
int
mb_num
)
{
int
result
=
mb_num
*
profile
->
packet_scale
.
num
/
profile
->
packet_scale
.
den
;
result
=
(
result
+
2048
)
/
4096
*
4096
;
return
FFMAX
(
result
,
8192
);
}
static
av_cold
int
dnxhd_encode_init
(
AVCodecContext
*
avctx
)
{
DNXHDEncContext
*
ctx
=
avctx
->
priv_data
;
...
...
@@ -483,8 +476,8 @@ static av_cold int dnxhd_encode_init(AVCodecContext *avctx)
ctx
->
m
.
mb_num
=
ctx
->
m
.
mb_height
*
ctx
->
m
.
mb_width
;
if
(
ctx
->
cid_table
->
frame_size
==
DNXHD_VARIABLE
)
{
ctx
->
frame_size
=
dnxhd_get_hr_frame_size
(
ctx
->
cid_table
,
ctx
->
m
.
mb_num
);
ctx
->
frame_size
=
ff_dnxhd_get_hr_frame_size
(
ctx
->
cid
,
ctx
->
m
.
mb_width
,
ctx
->
m
.
mb_height
);
ctx
->
coding_unit_size
=
ctx
->
frame_size
;
}
else
{
ctx
->
frame_size
=
ctx
->
cid_table
->
frame_size
;
...
...
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