On Sat, Sep 24, 2016 at 01:58:07PM +0200, Luca Barbato wrote:
> From: Yogender Gupta <[email protected]>
> 
> They match the x264 terminology.
> ---
>  libavcodec/nvenc.c      | 7 +++++++
>  libavcodec/nvenc.h      | 7 ++++++-
>  libavcodec/nvenc_h264.c | 5 ++++-
>  libavcodec/nvenc_hevc.c | 5 ++++-
>  4 files changed, 21 insertions(+), 3 deletions(-)
> 
> diff --git a/libavcodec/nvenc.c b/libavcodec/nvenc.c
> index 6db5b0d..1084f83 100644
> --- a/libavcodec/nvenc.c
> +++ b/libavcodec/nvenc.c
> @@ -459,6 +459,9 @@ typedef struct GUIDTuple {
>      int flags;
>  } GUIDTuple;
>  
> +#define PRESET_ALIAS(alias, name, ...) \
> +    [PRESET_ ## alias] = { NV_ENC_PRESET_ ## name ## _GUID, __VA_ARGS__ }
> +
>  #define PRESET(name, ...) \
>      [PRESET_ ## name] = { NV_ENC_PRESET_ ## name ## _GUID, __VA_ARGS__ }

You can reuse the three-argument macro to express the two-argument
variang w/o code duplication.

> @@ -474,6 +477,9 @@ static int nvec_map_preset(NVENCContext *ctx)
>          PRESET(LOW_LATENCY_HQ,      NVENC_LOWLATENCY),
>          PRESET(LOSSLESS_DEFAULT,    NVENC_LOSSLESS),
>          PRESET(LOSSLESS_HP,         NVENC_LOSSLESS),
> +        PRESET_ALIAS(SLOW, HQ,      NVENC_TWO_PASSES),
> +        PRESET_ALIAS(MEDIUM, HQ,    NVENC_ONE_PASS),
> +        PRESET_ALIAS(FAST, HP,      NVENC_ONE_PASS),
>          { { 0 } }
>      };

I don't like this. Before this looked like:

NVPREFIX_THING = AVPREFIX_THING
NVPREFIX_ALIAS = AVPREFIX_THING

which is pretty straightforward. Now you have a level of macro
indirection that does not help IMO.

Patch looks OK otherwise, so if you insist...

Diego
_______________________________________________
libav-devel mailing list
[email protected]
https://lists.libav.org/mailman/listinfo/libav-devel

Reply via email to