* [FFmpeg-devel] [PATCH 1/2] avcodec/libvpxdec: remove unnecessary init_static_data function @ 2023-02-28 12:06 James Almer 2023-02-28 12:06 ` [FFmpeg-devel] [PATCH 2/2] libavcodec/libvpxenc: move libvpx-vp9 init_static_data function to the only place it's used James Almer 2023-02-28 20:40 ` [FFmpeg-devel] [PATCH 1/2] avcodec/libvpxdec: remove unnecessary init_static_data function James Zern 0 siblings, 2 replies; 6+ messages in thread From: James Almer @ 2023-02-28 12:06 UTC (permalink / raw) To: ffmpeg-devel It's used only by the encoder. Signed-off-by: James Almer <jamrial@gmail.com> --- libavcodec/libvpxdec.c | 1 - 1 file changed, 1 deletion(-) diff --git a/libavcodec/libvpxdec.c b/libavcodec/libvpxdec.c index 0ae19c3f72..8e6291fe20 100644 --- a/libavcodec/libvpxdec.c +++ b/libavcodec/libvpxdec.c @@ -391,6 +391,5 @@ FFCodec ff_libvpx_vp9_decoder = { FF_CODEC_DECODE_CB(vpx_decode), .caps_internal = FF_CODEC_CAP_NOT_INIT_THREADSAFE | FF_CODEC_CAP_AUTO_THREADS, - .init_static_data = ff_vp9_init_static, }; #endif /* CONFIG_LIBVPX_VP9_DECODER */ -- 2.39.2 _______________________________________________ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org https://ffmpeg.org/mailman/listinfo/ffmpeg-devel To unsubscribe, visit link above, or email ffmpeg-devel-request@ffmpeg.org with subject "unsubscribe". ^ permalink raw reply [flat|nested] 6+ messages in thread
* [FFmpeg-devel] [PATCH 2/2] libavcodec/libvpxenc: move libvpx-vp9 init_static_data function to the only place it's used 2023-02-28 12:06 [FFmpeg-devel] [PATCH 1/2] avcodec/libvpxdec: remove unnecessary init_static_data function James Almer @ 2023-02-28 12:06 ` James Almer 2023-02-28 20:40 ` [FFmpeg-devel] [PATCH 1/2] avcodec/libvpxdec: remove unnecessary init_static_data function James Zern 1 sibling, 0 replies; 6+ messages in thread From: James Almer @ 2023-02-28 12:06 UTC (permalink / raw) To: ffmpeg-devel Signed-off-by: James Almer <jamrial@gmail.com> --- libavcodec/Makefile | 4 +-- libavcodec/libvpx.c | 81 ------------------------------------------ libavcodec/libvpx.h | 10 ------ libavcodec/libvpxenc.c | 41 ++++++++++++++++++++- 4 files changed, 42 insertions(+), 94 deletions(-) delete mode 100644 libavcodec/libvpx.c diff --git a/libavcodec/Makefile b/libavcodec/Makefile index 389253f5d0..6c797b8e14 100644 --- a/libavcodec/Makefile +++ b/libavcodec/Makefile @@ -1121,8 +1121,8 @@ OBJS-$(CONFIG_LIBVORBIS_ENCODER) += libvorbisenc.o \ vorbis_data.o OBJS-$(CONFIG_LIBVPX_VP8_DECODER) += libvpxdec.o OBJS-$(CONFIG_LIBVPX_VP8_ENCODER) += libvpxenc.o -OBJS-$(CONFIG_LIBVPX_VP9_DECODER) += libvpxdec.o libvpx.o -OBJS-$(CONFIG_LIBVPX_VP9_ENCODER) += libvpxenc.o libvpx.o +OBJS-$(CONFIG_LIBVPX_VP9_DECODER) += libvpxdec.o +OBJS-$(CONFIG_LIBVPX_VP9_ENCODER) += libvpxenc.o OBJS-$(CONFIG_LIBWEBP_ENCODER) += libwebpenc_common.o libwebpenc.o OBJS-$(CONFIG_LIBWEBP_ANIM_ENCODER) += libwebpenc_common.o libwebpenc_animencoder.o OBJS-$(CONFIG_LIBX262_ENCODER) += libx264.o diff --git a/libavcodec/libvpx.c b/libavcodec/libvpx.c deleted file mode 100644 index 8601f82bd2..0000000000 --- a/libavcodec/libvpx.c +++ /dev/null @@ -1,81 +0,0 @@ -/* - * Copyright (c) 2013 Guillaume Martres <smarter@ubuntu.com> - * - * This file is part of FFmpeg. - * - * FFmpeg is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2.1 of the License, or (at your option) any later version. - * - * FFmpeg is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with FFmpeg; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA - */ - -#include <vpx/vpx_codec.h> -#include "libvpx.h" -#include "config.h" -#include "config_components.h" - -#if CONFIG_LIBVPX_VP9_ENCODER -#include <vpx/vpx_encoder.h> -#include <vpx/vp8cx.h> -#endif - -static const enum AVPixelFormat vp9_pix_fmts_def[] = { - AV_PIX_FMT_YUV420P, - AV_PIX_FMT_YUVA420P, - AV_PIX_FMT_NONE -}; - -#if CONFIG_LIBVPX_VP9_ENCODER -static const enum AVPixelFormat vp9_pix_fmts_highcol[] = { - AV_PIX_FMT_YUV420P, - AV_PIX_FMT_YUVA420P, - AV_PIX_FMT_YUV422P, - AV_PIX_FMT_YUV440P, - AV_PIX_FMT_YUV444P, - AV_PIX_FMT_GBRP, - AV_PIX_FMT_NONE -}; - -static const enum AVPixelFormat vp9_pix_fmts_highbd[] = { - AV_PIX_FMT_YUV420P, - AV_PIX_FMT_YUVA420P, - AV_PIX_FMT_YUV422P, - AV_PIX_FMT_YUV440P, - AV_PIX_FMT_YUV444P, - AV_PIX_FMT_YUV420P10, - AV_PIX_FMT_YUV422P10, - AV_PIX_FMT_YUV440P10, - AV_PIX_FMT_YUV444P10, - AV_PIX_FMT_YUV420P12, - AV_PIX_FMT_YUV422P12, - AV_PIX_FMT_YUV440P12, - AV_PIX_FMT_YUV444P12, - AV_PIX_FMT_GBRP, - AV_PIX_FMT_GBRP10, - AV_PIX_FMT_GBRP12, - AV_PIX_FMT_NONE -}; -#endif - -av_cold void ff_vp9_init_static(FFCodec *codec) -{ - codec->p.pix_fmts = vp9_pix_fmts_def; -#if CONFIG_LIBVPX_VP9_ENCODER - { - vpx_codec_caps_t codec_caps = vpx_codec_get_caps(vpx_codec_vp9_cx()); - if (codec_caps & VPX_CODEC_CAP_HIGHBITDEPTH) - codec->p.pix_fmts = vp9_pix_fmts_highbd; - else - codec->p.pix_fmts = vp9_pix_fmts_highcol; - } -#endif -} diff --git a/libavcodec/libvpx.h b/libavcodec/libvpx.h index 331feb8745..4671e0edef 100644 --- a/libavcodec/libvpx.h +++ b/libavcodec/libvpx.h @@ -21,16 +21,6 @@ #ifndef AVCODEC_LIBVPX_H #define AVCODEC_LIBVPX_H -#include <vpx/vpx_codec.h> - -#include "codec_internal.h" - #define MAX_VPX_THREADS 64 -void ff_vp9_init_static(FFCodec *codec); -#if 0 -enum AVPixelFormat ff_vpx_imgfmt_to_pixfmt(vpx_img_fmt_t img); -vpx_img_fmt_t ff_vpx_pixfmt_to_imgfmt(enum AVPixelFormat pix); -#endif - #endif /* AVCODEC_LIBVPX_H */ diff --git a/libavcodec/libvpxenc.c b/libavcodec/libvpxenc.c index 339d4d8146..5e6467a3d0 100644 --- a/libavcodec/libvpxenc.c +++ b/libavcodec/libvpxenc.c @@ -1979,6 +1979,45 @@ static av_cold int vp9_init(AVCodecContext *avctx) return vpx_init(avctx, vpx_codec_vp9_cx()); } +static const enum AVPixelFormat vp9_pix_fmts_highcol[] = { + AV_PIX_FMT_YUV420P, + AV_PIX_FMT_YUVA420P, + AV_PIX_FMT_YUV422P, + AV_PIX_FMT_YUV440P, + AV_PIX_FMT_YUV444P, + AV_PIX_FMT_GBRP, + AV_PIX_FMT_NONE +}; + +static const enum AVPixelFormat vp9_pix_fmts_highbd[] = { + AV_PIX_FMT_YUV420P, + AV_PIX_FMT_YUVA420P, + AV_PIX_FMT_YUV422P, + AV_PIX_FMT_YUV440P, + AV_PIX_FMT_YUV444P, + AV_PIX_FMT_YUV420P10, + AV_PIX_FMT_YUV422P10, + AV_PIX_FMT_YUV440P10, + AV_PIX_FMT_YUV444P10, + AV_PIX_FMT_YUV420P12, + AV_PIX_FMT_YUV422P12, + AV_PIX_FMT_YUV440P12, + AV_PIX_FMT_YUV444P12, + AV_PIX_FMT_GBRP, + AV_PIX_FMT_GBRP10, + AV_PIX_FMT_GBRP12, + AV_PIX_FMT_NONE +}; + +static av_cold void vp9_init_static(FFCodec *codec) +{ + vpx_codec_caps_t codec_caps = vpx_codec_get_caps(vpx_codec_vp9_cx()); + if (codec_caps & VPX_CODEC_CAP_HIGHBITDEPTH) + codec->p.pix_fmts = vp9_pix_fmts_highbd; + else + codec->p.pix_fmts = vp9_pix_fmts_highcol; +} + static const AVClass class_vp9 = { .class_name = "libvpx-vp9 encoder", .item_name = av_default_item_name, @@ -2003,6 +2042,6 @@ FFCodec ff_libvpx_vp9_encoder = { .caps_internal = FF_CODEC_CAP_NOT_INIT_THREADSAFE | FF_CODEC_CAP_AUTO_THREADS, .defaults = defaults, - .init_static_data = ff_vp9_init_static, + .init_static_data = vp9_init_static, }; #endif /* CONFIG_LIBVPX_VP9_ENCODER */ -- 2.39.2 _______________________________________________ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org https://ffmpeg.org/mailman/listinfo/ffmpeg-devel To unsubscribe, visit link above, or email ffmpeg-devel-request@ffmpeg.org with subject "unsubscribe". ^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [FFmpeg-devel] [PATCH 1/2] avcodec/libvpxdec: remove unnecessary init_static_data function 2023-02-28 12:06 [FFmpeg-devel] [PATCH 1/2] avcodec/libvpxdec: remove unnecessary init_static_data function James Almer 2023-02-28 12:06 ` [FFmpeg-devel] [PATCH 2/2] libavcodec/libvpxenc: move libvpx-vp9 init_static_data function to the only place it's used James Almer @ 2023-02-28 20:40 ` James Zern 2023-02-28 20:49 ` James Almer 1 sibling, 1 reply; 6+ messages in thread From: James Zern @ 2023-02-28 20:40 UTC (permalink / raw) To: FFmpeg development discussions and patches On Tue, Feb 28, 2023 at 4:07 AM James Almer <jamrial@gmail.com> wrote: > > It's used only by the encoder. > It sets AVCodec.pix_fmts, but maybe the values reported aren't used meaningfully. > Signed-off-by: James Almer <jamrial@gmail.com> > --- > libavcodec/libvpxdec.c | 1 - > 1 file changed, 1 deletion(-) > > diff --git a/libavcodec/libvpxdec.c b/libavcodec/libvpxdec.c > index 0ae19c3f72..8e6291fe20 100644 > --- a/libavcodec/libvpxdec.c > +++ b/libavcodec/libvpxdec.c > @@ -391,6 +391,5 @@ FFCodec ff_libvpx_vp9_decoder = { > FF_CODEC_DECODE_CB(vpx_decode), > .caps_internal = FF_CODEC_CAP_NOT_INIT_THREADSAFE | > FF_CODEC_CAP_AUTO_THREADS, > - .init_static_data = ff_vp9_init_static, > }; > #endif /* CONFIG_LIBVPX_VP9_DECODER */ > -- > 2.39.2 > _______________________________________________ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org https://ffmpeg.org/mailman/listinfo/ffmpeg-devel To unsubscribe, visit link above, or email ffmpeg-devel-request@ffmpeg.org with subject "unsubscribe". ^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [FFmpeg-devel] [PATCH 1/2] avcodec/libvpxdec: remove unnecessary init_static_data function 2023-02-28 20:40 ` [FFmpeg-devel] [PATCH 1/2] avcodec/libvpxdec: remove unnecessary init_static_data function James Zern @ 2023-02-28 20:49 ` James Almer 2023-02-28 21:20 ` James Zern 0 siblings, 1 reply; 6+ messages in thread From: James Almer @ 2023-02-28 20:49 UTC (permalink / raw) To: ffmpeg-devel On 2/28/2023 5:40 PM, James Zern wrote: > On Tue, Feb 28, 2023 at 4:07 AM James Almer <jamrial@gmail.com> wrote: >> >> It's used only by the encoder. >> > > It sets AVCodec.pix_fmts, but maybe the values reported aren't used > meaningfully. Indeed, they aren't. AVCodec.pix_fmts is a list of formats an encoder accepts as input. Decoders don't use that array. > >> Signed-off-by: James Almer <jamrial@gmail.com> >> --- >> libavcodec/libvpxdec.c | 1 - >> 1 file changed, 1 deletion(-) >> >> diff --git a/libavcodec/libvpxdec.c b/libavcodec/libvpxdec.c >> index 0ae19c3f72..8e6291fe20 100644 >> --- a/libavcodec/libvpxdec.c >> +++ b/libavcodec/libvpxdec.c >> @@ -391,6 +391,5 @@ FFCodec ff_libvpx_vp9_decoder = { >> FF_CODEC_DECODE_CB(vpx_decode), >> .caps_internal = FF_CODEC_CAP_NOT_INIT_THREADSAFE | >> FF_CODEC_CAP_AUTO_THREADS, >> - .init_static_data = ff_vp9_init_static, >> }; >> #endif /* CONFIG_LIBVPX_VP9_DECODER */ >> -- >> 2.39.2 >> > _______________________________________________ > ffmpeg-devel mailing list > ffmpeg-devel@ffmpeg.org > https://ffmpeg.org/mailman/listinfo/ffmpeg-devel > > To unsubscribe, visit link above, or email > ffmpeg-devel-request@ffmpeg.org with subject "unsubscribe". _______________________________________________ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org https://ffmpeg.org/mailman/listinfo/ffmpeg-devel To unsubscribe, visit link above, or email ffmpeg-devel-request@ffmpeg.org with subject "unsubscribe". ^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [FFmpeg-devel] [PATCH 1/2] avcodec/libvpxdec: remove unnecessary init_static_data function 2023-02-28 20:49 ` James Almer @ 2023-02-28 21:20 ` James Zern 2023-03-02 20:53 ` James Zern 0 siblings, 1 reply; 6+ messages in thread From: James Zern @ 2023-02-28 21:20 UTC (permalink / raw) To: FFmpeg development discussions and patches On Tue, Feb 28, 2023 at 12:49 PM James Almer <jamrial@gmail.com> wrote: > > On 2/28/2023 5:40 PM, James Zern wrote: > > On Tue, Feb 28, 2023 at 4:07 AM James Almer <jamrial@gmail.com> wrote: > >> > >> It's used only by the encoder. > >> > > > > It sets AVCodec.pix_fmts, but maybe the values reported aren't used > > meaningfully. > > Indeed, they aren't. AVCodec.pix_fmts is a list of formats an encoder > accepts as input. Decoders don't use that array. > lgtm. The documentation for that field maybe could use some clarification. A few other decoders look to set this, h263dec being one. > > > >> Signed-off-by: James Almer <jamrial@gmail.com> > >> --- > >> libavcodec/libvpxdec.c | 1 - > >> 1 file changed, 1 deletion(-) > >> > >> diff --git a/libavcodec/libvpxdec.c b/libavcodec/libvpxdec.c > >> index 0ae19c3f72..8e6291fe20 100644 > >> --- a/libavcodec/libvpxdec.c > >> +++ b/libavcodec/libvpxdec.c > >> @@ -391,6 +391,5 @@ FFCodec ff_libvpx_vp9_decoder = { > >> FF_CODEC_DECODE_CB(vpx_decode), > >> .caps_internal = FF_CODEC_CAP_NOT_INIT_THREADSAFE | > >> FF_CODEC_CAP_AUTO_THREADS, > >> - .init_static_data = ff_vp9_init_static, > >> }; > >> #endif /* CONFIG_LIBVPX_VP9_DECODER */ > >> -- > >> 2.39.2 > >> > > _______________________________________________ > > ffmpeg-devel mailing list > > ffmpeg-devel@ffmpeg.org > > https://ffmpeg.org/mailman/listinfo/ffmpeg-devel > > > > To unsubscribe, visit link above, or email > > ffmpeg-devel-request@ffmpeg.org with subject "unsubscribe". > _______________________________________________ > ffmpeg-devel mailing list > ffmpeg-devel@ffmpeg.org > https://ffmpeg.org/mailman/listinfo/ffmpeg-devel > > To unsubscribe, visit link above, or email > ffmpeg-devel-request@ffmpeg.org with subject "unsubscribe". _______________________________________________ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org https://ffmpeg.org/mailman/listinfo/ffmpeg-devel To unsubscribe, visit link above, or email ffmpeg-devel-request@ffmpeg.org with subject "unsubscribe". ^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [FFmpeg-devel] [PATCH 1/2] avcodec/libvpxdec: remove unnecessary init_static_data function 2023-02-28 21:20 ` James Zern @ 2023-03-02 20:53 ` James Zern 0 siblings, 0 replies; 6+ messages in thread From: James Zern @ 2023-03-02 20:53 UTC (permalink / raw) To: FFmpeg development discussions and patches On Tue, Feb 28, 2023 at 1:20 PM James Zern <jzern@google.com> wrote: > > On Tue, Feb 28, 2023 at 12:49 PM James Almer <jamrial@gmail.com> wrote: > > > > On 2/28/2023 5:40 PM, James Zern wrote: > > > On Tue, Feb 28, 2023 at 4:07 AM James Almer <jamrial@gmail.com> wrote: > > >> > > >> It's used only by the encoder. > > >> > > > > > > It sets AVCodec.pix_fmts, but maybe the values reported aren't used > > > meaningfully. > > > > Indeed, they aren't. AVCodec.pix_fmts is a list of formats an encoder > > accepts as input. Decoders don't use that array. > > > > lgtm. The documentation for that field maybe could use some > clarification. A few other decoders look to set this, h263dec being > one. > For what it's worth, prior to this patch -h decoder=libvpx-vp9 would display the supported formats: Supported pixel formats: yuv420p yuva420p yuv422p yuv440p yuv444p yuv420p10le yuv422p10le yuv440p10le yuv444p10le yuv420p12le yuv422p12le yuv440p12le yuv444p12le gbrp gbrp10le gbrp12le We used this in libvpx tests as one signal that --enable-vp9-bitdepth builds were integrated correctly with ffmpeg. libaom has a similar check. This is easy to update, though. The main point of those tests is to ensure the build doesn't break. > > > > > >> Signed-off-by: James Almer <jamrial@gmail.com> > > >> --- > > >> libavcodec/libvpxdec.c | 1 - > > >> 1 file changed, 1 deletion(-) > > >> > > >> diff --git a/libavcodec/libvpxdec.c b/libavcodec/libvpxdec.c > > >> index 0ae19c3f72..8e6291fe20 100644 > > >> --- a/libavcodec/libvpxdec.c > > >> +++ b/libavcodec/libvpxdec.c > > >> @@ -391,6 +391,5 @@ FFCodec ff_libvpx_vp9_decoder = { > > >> FF_CODEC_DECODE_CB(vpx_decode), > > >> .caps_internal = FF_CODEC_CAP_NOT_INIT_THREADSAFE | > > >> FF_CODEC_CAP_AUTO_THREADS, > > >> - .init_static_data = ff_vp9_init_static, > > >> }; > > >> #endif /* CONFIG_LIBVPX_VP9_DECODER */ > > >> -- > > >> 2.39.2 > > >> > > > _______________________________________________ > > > ffmpeg-devel mailing list > > > ffmpeg-devel@ffmpeg.org > > > https://ffmpeg.org/mailman/listinfo/ffmpeg-devel > > > > > > To unsubscribe, visit link above, or email > > > ffmpeg-devel-request@ffmpeg.org with subject "unsubscribe". > > _______________________________________________ > > ffmpeg-devel mailing list > > ffmpeg-devel@ffmpeg.org > > https://ffmpeg.org/mailman/listinfo/ffmpeg-devel > > > > To unsubscribe, visit link above, or email > > ffmpeg-devel-request@ffmpeg.org with subject "unsubscribe". _______________________________________________ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org https://ffmpeg.org/mailman/listinfo/ffmpeg-devel To unsubscribe, visit link above, or email ffmpeg-devel-request@ffmpeg.org with subject "unsubscribe". ^ permalink raw reply [flat|nested] 6+ messages in thread
end of thread, other threads:[~2023-03-02 20:53 UTC | newest] Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed) -- links below jump to the message on this page -- 2023-02-28 12:06 [FFmpeg-devel] [PATCH 1/2] avcodec/libvpxdec: remove unnecessary init_static_data function James Almer 2023-02-28 12:06 ` [FFmpeg-devel] [PATCH 2/2] libavcodec/libvpxenc: move libvpx-vp9 init_static_data function to the only place it's used James Almer 2023-02-28 20:40 ` [FFmpeg-devel] [PATCH 1/2] avcodec/libvpxdec: remove unnecessary init_static_data function James Zern 2023-02-28 20:49 ` James Almer 2023-02-28 21:20 ` James Zern 2023-03-02 20:53 ` James Zern
Git Inbox Mirror of the ffmpeg-devel mailing list - see https://ffmpeg.org/mailman/listinfo/ffmpeg-devel This inbox may be cloned and mirrored by anyone: git clone --mirror https://master.gitmailbox.com/ffmpegdev/0 ffmpegdev/git/0.git # If you have public-inbox 1.1+ installed, you may # initialize and index your mirror using the following commands: public-inbox-init -V2 ffmpegdev ffmpegdev/ https://master.gitmailbox.com/ffmpegdev \ ffmpegdev@gitmailbox.com public-inbox-index ffmpegdev Example config snippet for mirrors. AGPL code for this site: git clone https://public-inbox.org/public-inbox.git