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
68e95ab8
Commit
68e95ab8
authored
Mar 29, 2014
by
Timothy Gu
Committed by
Vittorio Giovara
Mar 30, 2014
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
dnxhdenc: return meaningful return codes
parent
9e4e35b4
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
19 additions
and
19 deletions
+19
-19
dnxhdenc.c
libavcodec/dnxhdenc.c
+19
-19
No files found.
libavcodec/dnxhdenc.c
View file @
68e95ab8
...
...
@@ -153,7 +153,7 @@ static av_cold int dnxhd_init_vlc(DNXHDEncContext *ctx)
}
return
0
;
fail:
return
-
1
;
return
AVERROR
(
ENOMEM
)
;
}
static
av_cold
int
dnxhd_init_qmat
(
DNXHDEncContext
*
ctx
,
int
lbias
,
int
cbias
)
...
...
@@ -212,7 +212,7 @@ static av_cold int dnxhd_init_qmat(DNXHDEncContext *ctx, int lbias, int cbias)
return
0
;
fail:
return
-
1
;
return
AVERROR
(
ENOMEM
)
;
}
static
av_cold
int
dnxhd_init_rc
(
DNXHDEncContext
*
ctx
)
...
...
@@ -226,13 +226,13 @@ static av_cold int dnxhd_init_rc(DNXHDEncContext *ctx)
ctx
->
lambda
=
2
<<
LAMBDA_FRAC_BITS
;
// qscale 2
return
0
;
fail:
return
-
1
;
return
AVERROR
(
ENOMEM
)
;
}
static
av_cold
int
dnxhd_encode_init
(
AVCodecContext
*
avctx
)
{
DNXHDEncContext
*
ctx
=
avctx
->
priv_data
;
int
i
,
index
,
bit_depth
;
int
i
,
index
,
bit_depth
,
ret
;
switch
(
avctx
->
pix_fmt
)
{
case
AV_PIX_FMT_YUV422P
:
...
...
@@ -243,13 +243,13 @@ static av_cold int dnxhd_encode_init(AVCodecContext *avctx)
break
;
default:
av_log
(
avctx
,
AV_LOG_ERROR
,
"pixel format is incompatible with DNxHD
\n
"
);
return
-
1
;
return
AVERROR
(
EINVAL
)
;
}
ctx
->
cid
=
ff_dnxhd_find_cid
(
avctx
,
bit_depth
);
if
(
!
ctx
->
cid
)
{
av_log
(
avctx
,
AV_LOG_ERROR
,
"video parameters incompatible with DNxHD
\n
"
);
return
-
1
;
return
AVERROR
(
EINVAL
)
;
}
av_log
(
avctx
,
AV_LOG_DEBUG
,
"cid %d
\n
"
,
ctx
->
cid
);
...
...
@@ -291,17 +291,17 @@ static av_cold int dnxhd_encode_init(AVCodecContext *avctx)
if
(
avctx
->
intra_quant_bias
!=
FF_DEFAULT_QUANT_BIAS
)
ctx
->
m
.
intra_quant_bias
=
avctx
->
intra_quant_bias
;
if
(
dnxhd_init_qmat
(
ctx
,
ctx
->
m
.
intra_quant_bias
,
0
)
<
0
)
// XXX tune lbias/cbias
return
-
1
;
if
(
(
ret
=
dnxhd_init_qmat
(
ctx
,
ctx
->
m
.
intra_quant_bias
,
0
)
)
<
0
)
// XXX tune lbias/cbias
return
ret
;
// Avid Nitris hardware decoder requires a minimum amount of padding in the coding unit payload
if
(
ctx
->
nitris_compat
)
ctx
->
min_padding
=
1600
;
if
(
dnxhd_init_vlc
(
ctx
)
<
0
)
return
-
1
;
if
(
dnxhd_init_rc
(
ctx
)
<
0
)
return
-
1
;
if
(
(
ret
=
dnxhd_init_vlc
(
ctx
)
)
<
0
)
return
ret
;
if
(
(
ret
=
dnxhd_init_rc
(
ctx
)
)
<
0
)
return
ret
;
FF_ALLOCZ_OR_GOTO
(
ctx
->
m
.
avctx
,
ctx
->
slice_size
,
ctx
->
m
.
mb_height
*
sizeof
(
uint32_t
),
fail
);
FF_ALLOCZ_OR_GOTO
(
ctx
->
m
.
avctx
,
ctx
->
slice_offs
,
ctx
->
m
.
mb_height
*
sizeof
(
uint32_t
),
fail
);
...
...
@@ -317,7 +317,7 @@ static av_cold int dnxhd_encode_init(AVCodecContext *avctx)
if
(
avctx
->
thread_count
>
MAX_THREADS
)
{
av_log
(
avctx
,
AV_LOG_ERROR
,
"too many threads
\n
"
);
return
-
1
;
return
AVERROR
(
EINVAL
)
;
}
ctx
->
thread
[
0
]
=
ctx
;
...
...
@@ -328,7 +328,7 @@ static av_cold int dnxhd_encode_init(AVCodecContext *avctx)
return
0
;
fail:
//for FF_ALLOCZ_OR_GOTO
return
-
1
;
return
AVERROR
(
ENOMEM
)
;
}
static
int
dnxhd_write_header
(
AVCodecContext
*
avctx
,
uint8_t
*
buf
)
...
...
@@ -726,7 +726,7 @@ static int dnxhd_encode_rdo(AVCodecContext *avctx, DNXHDEncContext *ctx)
// lambda, last_higher, last_lower, bits, ctx->frame_bits);
if
(
end
)
{
if
(
bits
>
ctx
->
frame_bits
)
return
-
1
;
return
AVERROR
(
EINVAL
)
;
break
;
}
if
(
bits
<
ctx
->
frame_bits
)
{
...
...
@@ -745,7 +745,7 @@ static int dnxhd_encode_rdo(AVCodecContext *avctx, DNXHDEncContext *ctx)
if
(
last_lower
!=
INT_MAX
)
lambda
=
(
lambda
+
last_lower
)
>>
1
;
else
if
((
int64_t
)
lambda
+
up_step
>
INT_MAX
)
return
-
1
;
return
AVERROR
(
EINVAL
)
;
else
lambda
+=
up_step
;
up_step
=
FFMIN
((
int64_t
)
up_step
*
5
,
INT_MAX
);
...
...
@@ -807,7 +807,7 @@ static int dnxhd_find_qscale(DNXHDEncContext *ctx)
qscale
+=
up_step
++
;
down_step
=
1
;
if
(
qscale
>=
ctx
->
m
.
avctx
->
qmax
)
return
-
1
;
return
AVERROR
(
EINVAL
)
;
}
}
//av_dlog(ctx->m.avctx, "out qscale %d\n", qscale);
...
...
@@ -876,7 +876,7 @@ static int dnxhd_encode_fast(AVCodecContext *avctx, DNXHDEncContext *ctx)
int
max_bits
=
0
;
int
ret
,
x
,
y
;
if
((
ret
=
dnxhd_find_qscale
(
ctx
))
<
0
)
return
-
1
;
return
ret
;
for
(
y
=
0
;
y
<
ctx
->
m
.
mb_height
;
y
++
)
{
for
(
x
=
0
;
x
<
ctx
->
m
.
mb_width
;
x
++
)
{
int
mb
=
y
*
ctx
->
m
.
mb_width
+
x
;
...
...
@@ -955,7 +955,7 @@ static int dnxhd_encode_picture(AVCodecContext *avctx, AVPacket *pkt,
if
(
ret
<
0
)
{
av_log
(
avctx
,
AV_LOG_ERROR
,
"picture could not fit ratecontrol constraints, increase qmax
\n
"
);
return
-
1
;
return
ret
;
}
dnxhd_setup_threads_slices
(
ctx
);
...
...
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