Re: [libav-devel] [PATCH 1/2] libvpx: Support all pixel formats available in encoding and decoding

2015-06-12 Thread Vittorio Giovara
On Thu, Jun 11, 2015 at 3:56 PM, Luca Barbato lu_z...@gentoo.org wrote:
 From: Vittorio Giovara vittorio.giov...@gmail.com

 Bump the minimum libvpx version to 1.4.0 so that all pixel
 formats are present. Add new VP9 profiles.

 Signed-off-by: Vittorio Giovara vittorio.giov...@gmail.com
 Signed-off-by: Luca Barbato lu_z...@gentoo.org

You did most of the work now, this patch actually belongs to you.


  configure  | 23 +++--
  libavcodec/avcodec.h   |  4 
  libavcodec/libvpx.c| 56 
 ++
  libavcodec/libvpx.h|  3 ++-
  libavcodec/libvpxdec.c |  7 ++-
  libavcodec/libvpxenc.c | 32 +
  6 files changed, 96 insertions(+), 29 deletions(-)

Don't forget version.h and maybe changelog

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


[libav-devel] [PATCH 1/2] libvpx: Support all pixel formats available in encoding and decoding

2015-06-11 Thread Luca Barbato
From: Vittorio Giovara vittorio.giov...@gmail.com

Bump the minimum libvpx version to 1.4.0 so that all pixel
formats are present. Add new VP9 profiles.

Signed-off-by: Vittorio Giovara vittorio.giov...@gmail.com
Signed-off-by: Luca Barbato lu_z...@gentoo.org
---

The next one should be squashed with this one.

 configure  | 23 +++--
 libavcodec/avcodec.h   |  4 
 libavcodec/libvpx.c| 56 ++
 libavcodec/libvpx.h|  3 ++-
 libavcodec/libvpxdec.c |  7 ++-
 libavcodec/libvpxenc.c | 32 +
 6 files changed, 96 insertions(+), 29 deletions(-)

diff --git a/configure b/configure
index b10715f..a416dc2 100755
--- a/configure
+++ b/configure
@@ -4311,12 +4311,23 @@ enabled libvo_aacenc   require libvo_aacenc 
vo-aacenc/voAAC.h voGetAACEncA
 enabled libvo_amrwbenc require libvo_amrwbenc vo-amrwbenc/enc_if.h 
E_IF_init -lvo-amrwbenc
 enabled libvorbis  require libvorbis vorbis/vorbisenc.h 
vorbis_info_init -lvorbisenc -lvorbis -logg
 enabled libvpx {
-enabled libvpx_vp8_decoder  { check_lib2 vpx/vpx_decoder.h vpx/vp8dx.h 
vpx_codec_dec_init_ver -lvpx ||
-die ERROR: libvpx decoder version must be 
=0.9.1; }
-enabled libvpx_vp8_encoder  { check_lib2 vpx/vpx_encoder.h vpx/vp8cx.h 
vpx_codec_enc_init_ver VPX_CQ -lvpx ||
-die ERROR: libvpx encoder version must be 
=0.9.6; }
-enabled libvpx_vp9_decoder  { check_lib2 vpx/vpx_decoder.h vpx/vp8dx.h 
vpx_codec_vp9_dx -lvpx || disable libvpx_vp9_decoder; }
-enabled libvpx_vp9_encoder  { check_lib2 vpx/vpx_encoder.h vpx/vp8cx.h 
vpx_codec_vp9_cx -lvpx || disable libvpx_vp9_encoder; } }
+enabled libvpx_vp8_decoder  {
+require vpx = 1.4.0 vpx/vpx_decoder.h vpx_codec_dec_init_ver -lvpx 
||
+die ERROR: libvpx encoder version must be =1.4.0;
+}
+enabled libvpx_vp8_encoder  {
+require vpx = 1.4.0 vpx/vpx_encoder.h vpx_codec_enc_init_ver -lvpx 
||
+die ERROR: libvpx encoder version must be =1.4.0;
+}
+enabled libvpx_vp9_decoder  {
+require vpx = 1.4.0 vpx/vpx_decoder.h vpx_codec_dec_init_ver -lvpx 
||
+disable libvpx_vp9_decoder;
+}
+enabled libvpx_vp9_encoder  {
+require vpx = 1.4.0 vpx/vpx_encoder.h vpx_codec_enc_init_ver -lvpx 
||
+disable libvpx_vp9_encoder;
+}
+}
 enabled libwavpack require libwavpack wavpack/wavpack.h 
WavpackOpenFileOutput  -lwavpack
 enabled libwebprequire_pkg_config libwebp webp/encode.h 
WebPGetEncoderVersion
 enabled libx264require_pkg_config x264 stdint.h x264.h 
x264_encoder_encode 
diff --git a/libavcodec/avcodec.h b/libavcodec/avcodec.h
index 3440126..16af20c 100644
--- a/libavcodec/avcodec.h
+++ b/libavcodec/avcodec.h
@@ -2702,6 +2702,10 @@ typedef struct AVCodecContext {
 #define FF_PROFILE_JPEG2000_DCINEMA_2K  3
 #define FF_PROFILE_JPEG2000_DCINEMA_4K  4

+#define FF_PROFILE_VP9_00
+#define FF_PROFILE_VP9_11
+#define FF_PROFILE_VP9_22
+#define FF_PROFILE_VP9_33

 #define FF_PROFILE_HEVC_MAIN1
 #define FF_PROFILE_HEVC_MAIN_10 2
diff --git a/libavcodec/libvpx.c b/libavcodec/libvpx.c
index 20f4484..603ed13 100644
--- a/libavcodec/libvpx.c
+++ b/libavcodec/libvpx.c
@@ -22,14 +22,54 @@

 #include libvpx.h

-int ff_vp9_check_experimental(AVCodecContext *avctx)
+enum AVPixelFormat ff_vpx_imgfmt_to_pixfmt(vpx_img_fmt_t img)
 {
-if (avctx-strict_std_compliance  FF_COMPLIANCE_EXPERIMENTAL 
-(vpx_codec_version_major()  1 ||
- (vpx_codec_version_major() == 1  vpx_codec_version_minor()  3))) {
-av_log(avctx, AV_LOG_ERROR,
-   Non-experimental support of VP9 requires libvpx = 1.3.0\n);
-return AVERROR_EXPERIMENTAL;
+switch (img) {
+case VPX_IMG_FMT_RGB24: return AV_PIX_FMT_RGB24;
+case VPX_IMG_FMT_RGB565:return AV_PIX_FMT_RGB565BE;
+case VPX_IMG_FMT_RGB555:return AV_PIX_FMT_RGB555BE;
+case VPX_IMG_FMT_UYVY:  return AV_PIX_FMT_UYVY422;
+case VPX_IMG_FMT_YUY2:  return AV_PIX_FMT_YUYV422;
+case VPX_IMG_FMT_YVYU:  return AV_PIX_FMT_YVYU422;
+case VPX_IMG_FMT_BGR24: return AV_PIX_FMT_BGR24;
+case VPX_IMG_FMT_ARGB:  return AV_PIX_FMT_ARGB;
+case VPX_IMG_FMT_ARGB_LE:   return AV_PIX_FMT_BGRA;
+case VPX_IMG_FMT_RGB565_LE: return AV_PIX_FMT_RGB565LE;
+case VPX_IMG_FMT_RGB555_LE: return AV_PIX_FMT_RGB555LE;
+case VPX_IMG_FMT_I420:  return AV_PIX_FMT_YUV420P;
+case VPX_IMG_FMT_I422:  return AV_PIX_FMT_YUV422P;
+case VPX_IMG_FMT_I444:  return AV_PIX_FMT_YUV444P;
+case VPX_IMG_FMT_I440:  return AV_PIX_FMT_YUV440P;
+case VPX_IMG_FMT_444A:  return AV_PIX_FMT_YUVA444P;

Re: [libav-devel] [PATCH 1/2] libvpx: Support all pixel formats available in encoding and decoding

2015-06-11 Thread James Almer
On 11/06/15 11:56 AM, Luca Barbato wrote:
 @@ -321,8 +321,12 @@ static av_cold int vpx_init(AVCodecContext *avctx,
  /* 0-3: For non-zero values the encoder increasingly optimizes for 
 reduced
 complexity playback on low powered devices at the expense of encode
 quality. */
 -   if (avctx-profile != FF_PROFILE_UNKNOWN)
 -   enccfg.g_profile = avctx-profile;
 +if (avctx-profile != FF_PROFILE_UNKNOWN)
 +enccfg.g_profile = avctx-profile;
 +else if (avctx-pix_fmt == AV_PIX_FMT_YUV440P)

As i said before, profile 0 is 8bit yuv420p.

 +avctx-profile = enccfg.g_profile = FF_PROFILE_VP9_0;
 +else
 +avctx-profile = enccfg.g_profile = FF_PROFILE_VP9_1;
 
  enccfg.g_error_resilient = ctx-error_resilient;
 


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


Re: [libav-devel] [PATCH 1/2] libvpx: Support all pixel formats available in encoding and decoding

2015-06-11 Thread Luca Barbato
On 11/06/15 21:11, James Almer wrote:
 On 11/06/15 11:56 AM, Luca Barbato wrote:
 @@ -321,8 +321,12 @@ static av_cold int vpx_init(AVCodecContext *avctx,
  /* 0-3: For non-zero values the encoder increasingly optimizes for 
 reduced
 complexity playback on low powered devices at the expense of encode
 quality. */
 -   if (avctx-profile != FF_PROFILE_UNKNOWN)
 -   enccfg.g_profile = avctx-profile;
 +if (avctx-profile != FF_PROFILE_UNKNOWN)
 +enccfg.g_profile = avctx-profile;
 +else if (avctx-pix_fmt == AV_PIX_FMT_YUV440P)
 
 As i said before, profile 0 is 8bit yuv420p.
 
 +avctx-profile = enccfg.g_profile = FF_PROFILE_VP9_0;
 +else
 +avctx-profile = enccfg.g_profile = FF_PROFILE_VP9_1;

  enccfg.g_error_resilient = ctx-error_resilient;


That typo is surprisingly resilient... You will get a soft beverage of
choice by whoever will push the wrong version =)

lu

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


[libav-devel] [PATCH 1/2] libvpx: Support all pixel formats available in encoding and decoding

2015-05-27 Thread Vittorio Giovara
Bump the minimum libvpx version to 1.4.0 so that all pixel
formats are present. Add new VP9 profiles.

Signed-off-by: Vittorio Giovara vittorio.giov...@gmail.com
---
 configure  | 12 +++
 libavcodec/avcodec.h   |  4 
 libavcodec/libvpx.c| 56 ++
 libavcodec/libvpx.h|  3 ++-
 libavcodec/libvpxdec.c |  7 ++-
 libavcodec/libvpxenc.c | 32 +
 libavcodec/version.h   |  2 +-
 7 files changed, 88 insertions(+), 28 deletions(-)

diff --git a/configure b/configure
index 863e33b..28da759 100755
--- a/configure
+++ b/configure
@@ -4274,10 +4274,14 @@ enabled libvo_aacenc   require libvo_aacenc 
vo-aacenc/voAAC.h voGetAACEncA
 enabled libvo_amrwbenc require libvo_amrwbenc vo-amrwbenc/enc_if.h 
E_IF_init -lvo-amrwbenc
 enabled libvorbis  require libvorbis vorbis/vorbisenc.h 
vorbis_info_init -lvorbisenc -lvorbis -logg
 enabled libvpx {
-enabled libvpx_vp8_decoder  { check_lib2 vpx/vpx_decoder.h vpx/vp8dx.h 
vpx_codec_dec_init_ver -lvpx ||
-die ERROR: libvpx decoder version must be 
=0.9.1; }
-enabled libvpx_vp8_encoder  { check_lib2 vpx/vpx_encoder.h vpx/vp8cx.h 
vpx_codec_enc_init_ver VPX_CQ -lvpx ||
-die ERROR: libvpx encoder version must be 
=0.9.6; }
+enabled libvpx_vp8_decoder  {
+{ check_lib2 vpx/vpx_decoder.h vpx/vp8dx.h vpx_codec_dec_init_ver 
-lvpx 
+  check_lib2 vpx/vpx_image.h VPX_IMG_FMT_HIGHBITDEPTH;
+} || die ERROR: libvpx decoder version must be =1.4.0; }
+enabled libvpx_vp8_encoder  {
+{ check_lib2 vpx/vpx_encoder.h vpx/vp8cx.h vpx_codec_enc_init_ver 
VPX_CQ -lvpx 
+  check_lib2 vpx/vpx_image.h VPX_IMG_FMT_HIGHBITDEPTH;
+} || die ERROR: libvpx encoder version must be =1.4.0; }
 enabled libvpx_vp9_decoder  { check_lib2 vpx/vpx_decoder.h vpx/vp8dx.h 
vpx_codec_vp9_dx -lvpx || disable libvpx_vp9_decoder; }
 enabled libvpx_vp9_encoder  { check_lib2 vpx/vpx_encoder.h vpx/vp8cx.h 
vpx_codec_vp9_cx -lvpx || disable libvpx_vp9_encoder; } }
 enabled libwavpack require libwavpack wavpack/wavpack.h 
WavpackOpenFileOutput  -lwavpack
diff --git a/libavcodec/avcodec.h b/libavcodec/avcodec.h
index 3440126..16af20c 100644
--- a/libavcodec/avcodec.h
+++ b/libavcodec/avcodec.h
@@ -2702,6 +2702,10 @@ typedef struct AVCodecContext {
 #define FF_PROFILE_JPEG2000_DCINEMA_2K  3
 #define FF_PROFILE_JPEG2000_DCINEMA_4K  4
 
+#define FF_PROFILE_VP9_00
+#define FF_PROFILE_VP9_11
+#define FF_PROFILE_VP9_22
+#define FF_PROFILE_VP9_33
 
 #define FF_PROFILE_HEVC_MAIN1
 #define FF_PROFILE_HEVC_MAIN_10 2
diff --git a/libavcodec/libvpx.c b/libavcodec/libvpx.c
index 20f4484..603ed13 100644
--- a/libavcodec/libvpx.c
+++ b/libavcodec/libvpx.c
@@ -22,14 +22,54 @@
 
 #include libvpx.h
 
-int ff_vp9_check_experimental(AVCodecContext *avctx)
+enum AVPixelFormat ff_vpx_imgfmt_to_pixfmt(vpx_img_fmt_t img)
 {
-if (avctx-strict_std_compliance  FF_COMPLIANCE_EXPERIMENTAL 
-(vpx_codec_version_major()  1 ||
- (vpx_codec_version_major() == 1  vpx_codec_version_minor()  3))) {
-av_log(avctx, AV_LOG_ERROR,
-   Non-experimental support of VP9 requires libvpx = 1.3.0\n);
-return AVERROR_EXPERIMENTAL;
+switch (img) {
+case VPX_IMG_FMT_RGB24: return AV_PIX_FMT_RGB24;
+case VPX_IMG_FMT_RGB565:return AV_PIX_FMT_RGB565BE;
+case VPX_IMG_FMT_RGB555:return AV_PIX_FMT_RGB555BE;
+case VPX_IMG_FMT_UYVY:  return AV_PIX_FMT_UYVY422;
+case VPX_IMG_FMT_YUY2:  return AV_PIX_FMT_YUYV422;
+case VPX_IMG_FMT_YVYU:  return AV_PIX_FMT_YVYU422;
+case VPX_IMG_FMT_BGR24: return AV_PIX_FMT_BGR24;
+case VPX_IMG_FMT_ARGB:  return AV_PIX_FMT_ARGB;
+case VPX_IMG_FMT_ARGB_LE:   return AV_PIX_FMT_BGRA;
+case VPX_IMG_FMT_RGB565_LE: return AV_PIX_FMT_RGB565LE;
+case VPX_IMG_FMT_RGB555_LE: return AV_PIX_FMT_RGB555LE;
+case VPX_IMG_FMT_I420:  return AV_PIX_FMT_YUV420P;
+case VPX_IMG_FMT_I422:  return AV_PIX_FMT_YUV422P;
+case VPX_IMG_FMT_I444:  return AV_PIX_FMT_YUV444P;
+case VPX_IMG_FMT_I440:  return AV_PIX_FMT_YUV440P;
+case VPX_IMG_FMT_444A:  return AV_PIX_FMT_YUVA444P;
+case VPX_IMG_FMT_I42016:return AV_PIX_FMT_YUV420P16BE;
+case VPX_IMG_FMT_I42216:return AV_PIX_FMT_YUV422P16BE;
+case VPX_IMG_FMT_I44416:return AV_PIX_FMT_YUV444P16BE;
+default:return AV_PIX_FMT_NONE;
+}
+}
+
+vpx_img_fmt_t ff_vpx_pixfmt_to_imgfmt(enum AVPixelFormat pix)
+{
+switch (pix) {
+case AV_PIX_FMT_RGB24:return VPX_IMG_FMT_RGB24;
+case AV_PIX_FMT_RGB565BE: return VPX_IMG_FMT_RGB565;
+case 

Re: [libav-devel] [PATCH 1/2] libvpx: Support all pixel formats available in encoding and decoding

2015-05-27 Thread Luca Barbato
On 27/05/15 16:06, Vittorio Giovara wrote:
 Bump the minimum libvpx version to 1.4.0 so that all pixel
 formats are present. Add new VP9 profiles.
 
 Signed-off-by: Vittorio Giovara vittorio.giov...@gmail.com
 ---
  configure  | 12 +++
  libavcodec/avcodec.h   |  4 
  libavcodec/libvpx.c| 56 
 ++
  libavcodec/libvpx.h|  3 ++-
  libavcodec/libvpxdec.c |  7 ++-
  libavcodec/libvpxenc.c | 32 +
  libavcodec/version.h   |  2 +-
  7 files changed, 88 insertions(+), 28 deletions(-)
 
 diff --git a/configure b/configure
 index 863e33b..28da759 100755
 --- a/configure
 +++ b/configure
 @@ -4274,10 +4274,14 @@ enabled libvo_aacenc   require libvo_aacenc 
 vo-aacenc/voAAC.h voGetAACEncA
  enabled libvo_amrwbenc require libvo_amrwbenc vo-amrwbenc/enc_if.h 
 E_IF_init -lvo-amrwbenc
  enabled libvorbis  require libvorbis vorbis/vorbisenc.h 
 vorbis_info_init -lvorbisenc -lvorbis -logg
  enabled libvpx {
 -enabled libvpx_vp8_decoder  { check_lib2 vpx/vpx_decoder.h 
 vpx/vp8dx.h vpx_codec_dec_init_ver -lvpx ||
 -die ERROR: libvpx decoder version must 
 be =0.9.1; }
 -enabled libvpx_vp8_encoder  { check_lib2 vpx/vpx_encoder.h 
 vpx/vp8cx.h vpx_codec_enc_init_ver VPX_CQ -lvpx ||
 -die ERROR: libvpx encoder version must 
 be =0.9.6; }
 +enabled libvpx_vp8_decoder  {
 +{ check_lib2 vpx/vpx_decoder.h vpx/vp8dx.h vpx_codec_dec_init_ver 
 -lvpx 
 +  check_lib2 vpx/vpx_image.h VPX_IMG_FMT_HIGHBITDEPTH;
 +} || die ERROR: libvpx decoder version must be =1.4.0; }
 +enabled libvpx_vp8_encoder  {
 +{ check_lib2 vpx/vpx_encoder.h vpx/vp8cx.h vpx_codec_enc_init_ver 
 VPX_CQ -lvpx 
 +  check_lib2 vpx/vpx_image.h VPX_IMG_FMT_HIGHBITDEPTH;
 +} || die ERROR: libvpx encoder version must be =1.4.0; }

require_pkg_config vpx = 1.4.0 vpx/vpx_decoder.h vpx/vp8dx.h
vpx_codec_dec_init_ver

might be nicer.

lu


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