On Tue, Jul 28, 2015 at 6:56 PM, Luca Barbato <[email protected]> wrote: > On 28/07/15 16:23, Vittorio Giovara wrote: >> From: Arttu Ylä-Outinen <[email protected]> >> >> Signed-off-by: Vittorio Giovara <[email protected]> >> --- >> Changelog | 1 + >> configure | 4 + >> doc/encoders.texi | 24 +++++ >> doc/general.texi | 10 +- >> libavcodec/Makefile | 1 + >> libavcodec/allcodecs.c | 1 + >> libavcodec/libkvazaar.c | 258 >> ++++++++++++++++++++++++++++++++++++++++++++++++ >> libavcodec/version.h | 4 +- >> 8 files changed, 300 insertions(+), 3 deletions(-) >> create mode 100644 libavcodec/libkvazaar.c >> >> diff --git a/Changelog b/Changelog >> index 26efbf3..b91f6ee 100644 >> --- a/Changelog >> +++ b/Changelog >> @@ -41,6 +41,7 @@ version <next>: >> - Intel QSV-accelerated MPEG-2 video and HEVC encoding >> - bitstream filter for converting HEVC from MP4 to Annex B >> - Intel QSV-accelerated MPEG-2 video and HEVC decoding >> +- libkvazaar HEVC encoder >> >> >> version 11: >> diff --git a/configure b/configure >> index 88c167f..ad5233f 100755 >> --- a/configure >> +++ b/configure >> @@ -191,6 +191,7 @@ External library support: >> --enable-libfreetype enable libfreetype [no] >> --enable-libgsm enable GSM de/encoding via libgsm [no] >> --enable-libilbc enable iLBC de/encoding via libilbc [no] >> + --enable-libkvazaar enable HEVC encoding via libkvazaar [no] >> --enable-libmfx enable HW acceleration through libmfx >> --enable-libmp3lame enable MP3 encoding via libmp3lame [no] >> --enable-libopencore-amrnb enable AMR-NB de/encoding via >> libopencore-amrnb [no] >> @@ -1166,6 +1167,7 @@ EXTERNAL_LIBRARY_LIST=" >> libfreetype >> libgsm >> libilbc >> + libkvazaar >> libmfx >> libmp3lame >> libopencore_amrnb >> @@ -2099,6 +2101,7 @@ libgsm_ms_decoder_deps="libgsm" >> libgsm_ms_encoder_deps="libgsm" >> libilbc_decoder_deps="libilbc" >> libilbc_encoder_deps="libilbc" >> +libkvazaar_encoder_deps="libkvazaar" >> libmp3lame_encoder_deps="libmp3lame" >> libmp3lame_encoder_select="audio_frame_queue" >> libopencore_amrnb_decoder_deps="libopencore_amrnb" >> @@ -4336,6 +4339,7 @@ enabled libgsm && { for gsm_hdr in "gsm.h" >> "gsm/gsm.h"; do >> check_lib "${gsm_hdr}" gsm_create -lgsm >> && break; >> done || die "ERROR: libgsm not found"; } >> enabled libilbc && require libilbc ilbc.h >> WebRtcIlbcfix_InitDecode -lilbc >> +enabled libkvazaar && require2 libkvazaar kvazaar.h kvz_api_get >> -lkvazaar > > kvazaar should have a pkg-conf file. > >> +#include "libavutil/avassert.h" > > This facility is abused here. > >> + av_assert0(frame->width == ctx->config->width); >> + av_assert0(frame->height == ctx->config->height); >> + av_assert0(frame->format == avctx->pix_fmt); > > This may happen normally, do not crash this way, return a clear message > stating that it is not currently supported. > >> + >> + // Allocate input picture for kvazaar. >> + img_in = ctx->api->picture_alloc(frame->width, frame->height); >> + if (!img_in) { >> + av_log(avctx, AV_LOG_ERROR, "Failed to allocate picture.\n"); >> + retval = AVERROR(ENOMEM); >> + goto done; >> + } > > I wonder if adding cropping support in kvz would avoid having this. > >> + // Copy pixels from frame to img_in. >> + for (i = 0; i < 3; ++i) { >> + uint8_t *dst = img_in->data[i]; >> + uint8_t *src = frame->data[i]; >> + int width = i == 0 ? frame->width : frame->width / 2; >> + int height = i == 0 ? frame->height : frame->height / 2; >> + int y = 0; >> + for (y = 0; y < height; y++) { >> + memcpy(dst, src, width); >> + src += frame->linesize[i]; >> + dst += width; >> + } >> + } > > I think we have a function for that or we should and last year I think I > did something at least in the command line encoder to avoid this copy.
ping, is there any update on this? (cc'ing the authors in case they missed these comments) -- Vittorio _______________________________________________ libav-devel mailing list [email protected] https://lists.libav.org/mailman/listinfo/libav-devel
