[FFmpeg-devel] [PATCH 2/2] avcodec/nvenc: Handle non-square pixel aspect ratios

Michael Niedermayer michaelni at gmx.at
Wed Jan 28 06:28:23 CET 2015


On Tue, Jan 27, 2015 at 04:46:54PM -0800, Philip Langdale wrote:
> On 2015-01-26 04:28, timo at rothenpieler.org wrote:
> >From: Timo Rothenpieler <timo at rothenpieler.org>
> >
> >---
> > libavcodec/nvenc.c | 17 +++++++++++++++--
> > 1 file changed, 15 insertions(+), 2 deletions(-)
> >
> >diff --git a/libavcodec/nvenc.c b/libavcodec/nvenc.c
> >index 2431c09..2cfc06a 100644
> >--- a/libavcodec/nvenc.c
> >+++ b/libavcodec/nvenc.c
> >@@ -472,6 +472,7 @@ static av_cold int
> >nvenc_encode_init(AVCodecContext *avctx)
> >     int i, num_mbs;
> >     int isLL = 0;
> >     int res = 0;
> >+    int dw, dh;
> >
> > #if NVENCAPI_MAJOR_VERSION < 5
> >     GUID license = dummy_license;
> >@@ -572,8 +573,20 @@ static av_cold int
> >nvenc_encode_init(AVCodecContext *avctx)
> >     ctx->init_encode_params.encodeGUID = NV_ENC_CODEC_H264_GUID;
> >     ctx->init_encode_params.encodeHeight = avctx->height;
> >     ctx->init_encode_params.encodeWidth = avctx->width;
> >-    ctx->init_encode_params.darHeight = avctx->height;
> >-    ctx->init_encode_params.darWidth = avctx->width;
> >+
> >+    if (avctx->sample_aspect_ratio.num &&
> >avctx->sample_aspect_ratio.den &&
> >+        (avctx->sample_aspect_ratio.num != 1 ||
> >avctx->sample_aspect_ratio.num != 1)) {
> >+        av_reduce(&dw, &dh,
> >+                  avctx->width * avctx->sample_aspect_ratio.num,
> >+                  avctx->height * avctx->sample_aspect_ratio.den,
> >+                  1024 * 1024);
> >+        ctx->init_encode_params.darHeight = dh;
> >+        ctx->init_encode_params.darWidth = dw;
> >+    } else {
> >+        ctx->init_encode_params.darHeight = avctx->height;
> >+        ctx->init_encode_params.darWidth = avctx->width;
> >+    }
> >+
> >     ctx->init_encode_params.frameRateNum = avctx->time_base.den;
> >     ctx->init_encode_params.frameRateDen = avctx->time_base.num *
> >avctx->ticks_per_frame;
> 
> I support pushing this. Let's get this in first and then we'll worry
> about the
> de-compensation.

applied

thanks

[...]
-- 
Michael     GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB

The worst form of inequality is to try to make unequal things equal.
-- Aristotle
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 181 bytes
Desc: Digital signature
URL: <https://ffmpeg.org/pipermail/ffmpeg-devel/attachments/20150128/a7d8031f/attachment.asc>


More information about the ffmpeg-devel mailing list