Re: [libav-devel] [PATCH] lavc/qsvenc: provide detail error message if parameters invalid

2018-03-04 Thread Li, Zhong
Thanks for quick response.  : ) 

> -Original Message-
> From: libav-devel [mailto:libav-devel-boun...@libav.org] On Behalf Of
> Maxym Dmytrychenko
> Sent: Friday, March 2, 2018 9:43 PM
> To: libav development <libav-devel@libav.org>
> Subject: Re: [libav-devel] [PATCH] lavc/qsvenc: provide detail error message
> if parameters invalid
> 
> The same :)
> 
> > 2 марта 2018 г., в 5:11, Luca Barbato <lu_z...@gentoo.org>
> написал(а):
> >
> >> On 02/03/2018 04:26, Zhong Li wrote:
> >> Currently always shows "Selected ratecontrol mode is not supported by
> >> the QSV runtime. Choose a different mode", but sometimes it is not
> >> accurate.
> >> Signed-off-by: Zhong Li <zhong...@intel.com>
> >> ---
> >>  libavcodec/qsvenc.c | 31 +--
> >>  1 file changed, 25 insertions(+), 6 deletions(-)
> >
> >
> > Looks good, thank you :)
___
libav-devel mailing list
libav-devel@libav.org
https://lists.libav.org/mailman/listinfo/libav-devel

Re: [libav-devel] [PATCH] lavc/qsvenc: provide detail error message if parameters invalid

2018-03-02 Thread Maxym Dmytrychenko
The same :)

> 2 марта 2018 г., в 5:11, Luca Barbato  написал(а):
> 
>> On 02/03/2018 04:26, Zhong Li wrote:
>> Currently always shows "Selected ratecontrol mode is not supported by
>> the QSV runtime. Choose a different mode", but sometimes it is not
>> accurate.
>> Signed-off-by: Zhong Li 
>> ---
>>  libavcodec/qsvenc.c | 31 +--
>>  1 file changed, 25 insertions(+), 6 deletions(-)
> 
> 
> Looks good, thank you :)
> 
> ___
> libav-devel mailing list
> libav-devel@libav.org
> https://lists.libav.org/mailman/listinfo/libav-devel
___
libav-devel mailing list
libav-devel@libav.org
https://lists.libav.org/mailman/listinfo/libav-devel

Re: [libav-devel] [PATCH] lavc/qsvenc: provide detail error message if parameters invalid

2018-03-02 Thread Luca Barbato

On 02/03/2018 04:26, Zhong Li wrote:

Currently always shows "Selected ratecontrol mode is not supported by
the QSV runtime. Choose a different mode", but sometimes it is not
accurate.

Signed-off-by: Zhong Li 
---
  libavcodec/qsvenc.c | 31 +--
  1 file changed, 25 insertions(+), 6 deletions(-)



Looks good, thank you :)

___
libav-devel mailing list
libav-devel@libav.org
https://lists.libav.org/mailman/listinfo/libav-devel

[libav-devel] [PATCH] lavc/qsvenc: provide detail error message if parameters invalid

2018-03-01 Thread Zhong Li
Currently always shows "Selected ratecontrol mode is not supported by
the QSV runtime. Choose a different mode", but sometimes it is not
accurate.

Signed-off-by: Zhong Li 
---
 libavcodec/qsvenc.c | 31 +--
 1 file changed, 25 insertions(+), 6 deletions(-)

diff --git a/libavcodec/qsvenc.c b/libavcodec/qsvenc.c
index 16d942f..d4dd4a3 100644
--- a/libavcodec/qsvenc.c
+++ b/libavcodec/qsvenc.c
@@ -356,15 +356,34 @@ static int select_rc_mode(AVCodecContext *avctx, 
QSVEncContext *q)
 return 0;
 }
 
-static int rc_supported(QSVEncContext *q)
+static int check_enc_param(AVCodecContext *avctx, QSVEncContext *q)
 {
 mfxVideoParam param_out = { .mfx.CodecId = q->param.mfx.CodecId };
 mfxStatus ret;
 
+#define UNMATCH(x) (param_out.mfx.x != q->param.mfx.x)
+
 ret = MFXVideoENCODE_Query(q->session, >param, _out);
-if (ret < 0 ||
-param_out.mfx.RateControlMethod != q->param.mfx.RateControlMethod)
+
+if (ret < 0) {
+if (UNMATCH(CodecId))
+av_log(avctx, AV_LOG_ERROR, "Current codec type is unsupported\n");
+if (UNMATCH(CodecProfile))
+av_log(avctx, AV_LOG_ERROR, "Current profile is unsupported\n");
+if (UNMATCH(RateControlMethod))
+av_log(avctx, AV_LOG_ERROR, "Selected ratecontrol mode is 
unsupported\n");
+if (UNMATCH(LowPower))
+  av_log(avctx, AV_LOG_ERROR, "Low power mode is unsupported\n");
+if (UNMATCH(FrameInfo.FrameRateExtN) || 
UNMATCH(FrameInfo.FrameRateExtN))
+  av_log(avctx, AV_LOG_ERROR, "Current frame rate is 
unsupported\n");
+if (UNMATCH(FrameInfo.PicStruct))
+  av_log(avctx, AV_LOG_ERROR, "Current picture structure is 
unsupported\n");
+if (UNMATCH(FrameInfo.Width) || UNMATCH(FrameInfo.Height))
+  av_log(avctx, AV_LOG_ERROR, "Current resolution is 
unsupported\n");
+if (UNMATCH(FrameInfo.FourCC))
+  av_log(avctx, AV_LOG_ERROR, "Current pixel format is 
unsupported\n");
 return 0;
+}
 return 1;
 }
 
@@ -639,10 +658,10 @@ FF_ENABLE_DEPRECATION_WARNINGS
 #endif
 }
 
-if (!rc_supported(q)) {
+if (!check_enc_param(avctx,q)) {
 av_log(avctx, AV_LOG_ERROR,
-   "Selected ratecontrol mode is not supported by the QSV "
-   "runtime. Choose a different mode.\n");
+   "some encoding parameters are not supported by the QSV "
+   "runtime. Please double check the input parameters.\n");
 return AVERROR(ENOSYS);
 }
 
-- 
1.8.3.1

___
libav-devel mailing list
libav-devel@libav.org
https://lists.libav.org/mailman/listinfo/libav-devel