[FFmpeg-devel] [PATCH] avcodec/dnxhdenc: return meaningful return codes
Michael Niedermayer
michaelni at gmx.at
Fri Jan 17 21:12:15 CET 2014
On Fri, Jan 17, 2014 at 10:11:31AM -0800, Timothy Gu wrote:
> On Fri, Jan 17, 2014 at 8:28 AM, Michael Niedermayer <michaelni at gmx.at> wrote:
> > On Thu, Jan 16, 2014 at 08:23:58PM -0800, Timothy Gu wrote:
> >> Also move error message to actual error function.
> >>
> >> Signed-off-by: Timothy Gu <timothygu99 at gmail.com>
> >
> > [...]
> >
> >> @@ -819,8 +819,11 @@ static int dnxhd_find_qscale(DNXHDEncContext *ctx)
> >> else
> >> qscale += up_step++;
> >> down_step = 1;
> >> - if (qscale >= ctx->m.avctx->qmax)
> >> - return -1;
> >> + if (qscale >= ctx->m.avctx->qmax){
> >> + av_log(avctx, AV_LOG_ERROR,
> >> + "picture could not fit ratecontrol constraints, increase qmax\n");
> >> + return AVERROR(EINVAL);
> >> + }
> >> }
> >> }
> >> //av_dlog(ctx->m.avctx, "out qscale %d\n", qscale);
> >
> > this fails compiling
>
> Ooops. Will fix.
>
> >
> >
> >
> >> @@ -889,7 +892,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;
> >
> >> @@ -963,11 +966,8 @@ static int dnxhd_encode_picture(AVCodecContext *avctx, AVPacket *pkt,
> >> ret = dnxhd_encode_rdo(avctx, ctx);
> >> else
> >> ret = dnxhd_encode_fast(avctx, ctx);
> >> - if (ret < 0) {
> >> - av_log(avctx, AV_LOG_ERROR,
> >> - "picture could not fit ratecontrol constraints, increase qmax\n");
> >> - return -1;
> >> - }
> >> + if (ret < 0)
> >> + return ret;
> >
> > this looses the error message for dnxhd_encode_rdo()
>
> The error message does not apply to dnxhd_encode_rdo in the first place.
it does, you can convince yourself of that by variing qmax to see it
fails when qmax is too low
[...]
--
Michael GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB
In a rich man's house there is no place to spit but his face.
-- Diogenes of Sinope
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 198 bytes
Desc: Digital signature
URL: <http://ffmpeg.org/pipermail/ffmpeg-devel/attachments/20140117/f215cd86/attachment.asc>
More information about the ffmpeg-devel
mailing list