[FFmpeg-devel,1/2] avfilter/proresenc: switch default prores encoder to prores_ks

Submitted by Paul B Mahol on June 26, 2017, 2:09 p.m.

Details

Message ID 20170626140958.2881-1-onemda@gmail.com
State New
Headers show

Commit Message

Paul B Mahol June 26, 2017, 2:09 p.m.
Rationale:
prores_ks have more features and is faster for qscale > 0
and gives better quality output.

Signed-off-by: Paul B Mahol <onemda@gmail.com>
---
 libavcodec/Makefile             |  2 +-
 libavcodec/proresenc_anatoliy.c | 14 --------------
 libavcodec/proresenc_kostya.c   | 17 +++++++++++++++++
 3 files changed, 18 insertions(+), 15 deletions(-)

Comments

Jan Ekström June 26, 2017, 5:46 p.m.
On Mon, Jun 26, 2017 at 5:09 PM, Paul B Mahol <onemda@gmail.com> wrote:
> Rationale:
> prores_ks have more features and is faster for qscale > 0
> and gives better quality output.
>

You probably meant s/avfilter/avcodec/ :) All those filters you've
made have put a template in your mind ;) .

Generally LGTM for me. Does this need an API/ABI bump?

Jan
Michael Niedermayer June 26, 2017, 8:53 p.m.
On Mon, Jun 26, 2017 at 04:09:57PM +0200, Paul B Mahol wrote:
> Rationale:
> prores_ks have more features and is faster for qscale > 0
> and gives better quality output.
> 
> Signed-off-by: Paul B Mahol <onemda@gmail.com>
> ---
>  libavcodec/Makefile             |  2 +-
>  libavcodec/proresenc_anatoliy.c | 14 --------------
>  libavcodec/proresenc_kostya.c   | 17 +++++++++++++++++
>  3 files changed, 18 insertions(+), 15 deletions(-)
> 
> diff --git a/libavcodec/Makefile b/libavcodec/Makefile
> index f0cba88..16dce40 100644
> --- a/libavcodec/Makefile
> +++ b/libavcodec/Makefile
> @@ -477,7 +477,7 @@ OBJS-$(CONFIG_PPM_DECODER)             += pnmdec.o pnm.o
>  OBJS-$(CONFIG_PPM_ENCODER)             += pnmenc.o
>  OBJS-$(CONFIG_PRORES_DECODER)          += proresdec2.o proresdsp.o proresdata.o
>  OBJS-$(CONFIG_PRORES_LGPL_DECODER)     += proresdec_lgpl.o proresdsp.o proresdata.o
> -OBJS-$(CONFIG_PRORES_ENCODER)          += proresenc_anatoliy.o
> +OBJS-$(CONFIG_PRORES_ENCODER)          += proresenc_kostya.o proresdata.o
>  OBJS-$(CONFIG_PRORES_AW_ENCODER)       += proresenc_anatoliy.o
>  OBJS-$(CONFIG_PRORES_KS_ENCODER)       += proresenc_kostya.o proresdata.o
>  OBJS-$(CONFIG_PSD_DECODER)             += psd.o
> diff --git a/libavcodec/proresenc_anatoliy.c b/libavcodec/proresenc_anatoliy.c
> index 0516066..7ff6ff7 100644
> --- a/libavcodec/proresenc_anatoliy.c
> +++ b/libavcodec/proresenc_anatoliy.c
> @@ -614,17 +614,3 @@ AVCodec ff_prores_aw_encoder = {
>      .capabilities   = AV_CODEC_CAP_FRAME_THREADS | AV_CODEC_CAP_INTRA_ONLY,
>      .profiles       = profiles
>  };
> -
> -AVCodec ff_prores_encoder = {
> -    .name           = "prores",
> -    .long_name      = NULL_IF_CONFIG_SMALL("Apple ProRes"),
> -    .type           = AVMEDIA_TYPE_VIDEO,
> -    .id             = AV_CODEC_ID_PRORES,
> -    .priv_data_size = sizeof(ProresContext),
> -    .init           = prores_encode_init,
> -    .close          = prores_encode_close,
> -    .encode2        = prores_encode_frame,
> -    .pix_fmts       = (const enum AVPixelFormat[]){AV_PIX_FMT_YUV422P10, AV_PIX_FMT_NONE},
> -    .capabilities   = AV_CODEC_CAP_FRAME_THREADS | AV_CODEC_CAP_INTRA_ONLY,
> -    .profiles       = profiles
> -};
> diff --git a/libavcodec/proresenc_kostya.c b/libavcodec/proresenc_kostya.c
> index 09bb611..21c2673 100644
> --- a/libavcodec/proresenc_kostya.c
> +++ b/libavcodec/proresenc_kostya.c
> @@ -1357,3 +1357,20 @@ AVCodec ff_prores_ks_encoder = {
>                        },
>      .priv_class     = &proresenc_class,
>  };
> +
> +AVCodec ff_prores_encoder = {
> +    .name           = "prores",
> +    .long_name      = NULL_IF_CONFIG_SMALL("Apple ProRes (iCodec Pro)"),
> +    .type           = AVMEDIA_TYPE_VIDEO,
> +    .id             = AV_CODEC_ID_PRORES,
> +    .priv_data_size = sizeof(ProresContext),
> +    .init           = encode_init,
> +    .close          = encode_close,
> +    .encode2        = encode_frame,
> +    .capabilities   = AV_CODEC_CAP_SLICE_THREADS | AV_CODEC_CAP_FRAME_THREADS | AV_CODEC_CAP_INTRA_ONLY,
> +    .pix_fmts       = (const enum AVPixelFormat[]) {
> +                          AV_PIX_FMT_YUV422P10, AV_PIX_FMT_YUV444P10,
> +                          AV_PIX_FMT_YUVA444P10, AV_PIX_FMT_NONE
> +                      },
> +    .priv_class     = &proresenc_class,

the same priv_class cannot be used twice. The code deadlocks if you
do.
i would of course prefer if priv_class was semantically a
class and could be reused, its neither the first and likely wont be
the last time someone hits this issue ...

try
./ffmpeg -help full
to see the issue

but make fate deadlocks as well

[...]

Patch hide | download patch | download mbox

diff --git a/libavcodec/Makefile b/libavcodec/Makefile
index f0cba88..16dce40 100644
--- a/libavcodec/Makefile
+++ b/libavcodec/Makefile
@@ -477,7 +477,7 @@  OBJS-$(CONFIG_PPM_DECODER)             += pnmdec.o pnm.o
 OBJS-$(CONFIG_PPM_ENCODER)             += pnmenc.o
 OBJS-$(CONFIG_PRORES_DECODER)          += proresdec2.o proresdsp.o proresdata.o
 OBJS-$(CONFIG_PRORES_LGPL_DECODER)     += proresdec_lgpl.o proresdsp.o proresdata.o
-OBJS-$(CONFIG_PRORES_ENCODER)          += proresenc_anatoliy.o
+OBJS-$(CONFIG_PRORES_ENCODER)          += proresenc_kostya.o proresdata.o
 OBJS-$(CONFIG_PRORES_AW_ENCODER)       += proresenc_anatoliy.o
 OBJS-$(CONFIG_PRORES_KS_ENCODER)       += proresenc_kostya.o proresdata.o
 OBJS-$(CONFIG_PSD_DECODER)             += psd.o
diff --git a/libavcodec/proresenc_anatoliy.c b/libavcodec/proresenc_anatoliy.c
index 0516066..7ff6ff7 100644
--- a/libavcodec/proresenc_anatoliy.c
+++ b/libavcodec/proresenc_anatoliy.c
@@ -614,17 +614,3 @@  AVCodec ff_prores_aw_encoder = {
     .capabilities   = AV_CODEC_CAP_FRAME_THREADS | AV_CODEC_CAP_INTRA_ONLY,
     .profiles       = profiles
 };
-
-AVCodec ff_prores_encoder = {
-    .name           = "prores",
-    .long_name      = NULL_IF_CONFIG_SMALL("Apple ProRes"),
-    .type           = AVMEDIA_TYPE_VIDEO,
-    .id             = AV_CODEC_ID_PRORES,
-    .priv_data_size = sizeof(ProresContext),
-    .init           = prores_encode_init,
-    .close          = prores_encode_close,
-    .encode2        = prores_encode_frame,
-    .pix_fmts       = (const enum AVPixelFormat[]){AV_PIX_FMT_YUV422P10, AV_PIX_FMT_NONE},
-    .capabilities   = AV_CODEC_CAP_FRAME_THREADS | AV_CODEC_CAP_INTRA_ONLY,
-    .profiles       = profiles
-};
diff --git a/libavcodec/proresenc_kostya.c b/libavcodec/proresenc_kostya.c
index 09bb611..21c2673 100644
--- a/libavcodec/proresenc_kostya.c
+++ b/libavcodec/proresenc_kostya.c
@@ -1357,3 +1357,20 @@  AVCodec ff_prores_ks_encoder = {
                       },
     .priv_class     = &proresenc_class,
 };
+
+AVCodec ff_prores_encoder = {
+    .name           = "prores",
+    .long_name      = NULL_IF_CONFIG_SMALL("Apple ProRes (iCodec Pro)"),
+    .type           = AVMEDIA_TYPE_VIDEO,
+    .id             = AV_CODEC_ID_PRORES,
+    .priv_data_size = sizeof(ProresContext),
+    .init           = encode_init,
+    .close          = encode_close,
+    .encode2        = encode_frame,
+    .capabilities   = AV_CODEC_CAP_SLICE_THREADS | AV_CODEC_CAP_FRAME_THREADS | AV_CODEC_CAP_INTRA_ONLY,
+    .pix_fmts       = (const enum AVPixelFormat[]) {
+                          AV_PIX_FMT_YUV422P10, AV_PIX_FMT_YUV444P10,
+                          AV_PIX_FMT_YUVA444P10, AV_PIX_FMT_NONE
+                      },
+    .priv_class     = &proresenc_class,
+};