On 7/9/2019 3:34 PM, Derek Buitenhuis wrote: > Port to the new send/receive API by: James Almer <jamr...@gmail.com>. > > Signed-off-by: Derek Buitenhuis <derek.buitenh...@gmail.com> > --- > Lots of stuff happened since v3! > > * The C API / library is now in rav1e's main repo, and officially supported. > * rav1e will bump the soname and pkg-config version on any breaking changes. > * C API is now as fast as the Rust API. > * Added two pass support. > * Added min quantizer support. > * Added tiles / speed to AVOptions. > * Mapped min/max keyint. > * Applied all the fixes requested in the last round. > --- > configure | 4 + > doc/encoders.texi | 37 +++ > doc/general.texi | 7 + > libavcodec/Makefile | 1 + > libavcodec/allcodecs.c | 1 + > libavcodec/librav1e.c | 578 +++++++++++++++++++++++++++++++++++++++++ > 6 files changed, 628 insertions(+) > create mode 100644 libavcodec/librav1e.c
> +static int get_stats(AVCodecContext *avctx, int eos) > +{ > + librav1eContext *ctx = avctx->priv_data; > + uint8_t *buf; > + size_t buf_size = 0; > + > + buf = rav1e_twopass_out(ctx->ctx, &buf_size); > + if (!buf) > + return 0; > + > + if (!eos) { > + uint8_t *tmp = av_fast_realloc(ctx->pass_data, &ctx->pass_size, > + ctx->pass_pos + buf_size); Just use av_reallocp(). Each call will make the buffer bigger, so you're not really making use the no-op benefits from av_fast_realloc(), which only trigger if newsize <= size. > +static av_cold int librav1e_encode_init(AVCodecContext *avctx) > +{ > + librav1eContext *ctx = avctx->priv_data; > + const AVPixFmtDescriptor *desc = av_pix_fmt_desc_get(avctx->pix_fmt); > + RaConfig *cfg = NULL; > + int rret; > + int ret = 0; > + > + cfg = rav1e_config_default(); > + if (!cfg) { > + av_log(avctx, AV_LOG_ERROR, "Could not allocate rav1e config.\n"); > + return AVERROR_EXTERNAL; > + } > + > + rav1e_config_set_time_base(cfg, (RaRational) { > + avctx->time_base.num * avctx->ticks_per_frame, > + avctx->time_base.den > + }); > + > + if (avctx->flags & AV_CODEC_FLAG_PASS2) { > + if (!avctx->stats_in) { > + av_log(avctx, AV_LOG_ERROR, "No stats file provided for second > pass.\n"); > + ret = AVERROR(EINVAL); > + goto end; > + } > + > + ctx->pass_size = (strlen(avctx->stats_in) * 3) / 4; AV_BASE64_DECODE_SIZE(strlen(avctx->stats_in)); _______________________________________________ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org https://ffmpeg.org/mailman/listinfo/ffmpeg-devel To unsubscribe, visit link above, or email ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".