Git Inbox Mirror of the ffmpeg-devel mailing list - see https://ffmpeg.org/mailman/listinfo/ffmpeg-devel
 help / color / mirror / Atom feed
* [FFmpeg-devel] [PATCH] avcodec/mediacodec: Add VP8 encoder
@ 2023-04-26 14:00 Samuel Raposo Vieira Mira
  2023-04-27 12:36 ` Tomas Härdin
  0 siblings, 1 reply; 7+ messages in thread
From: Samuel Raposo Vieira Mira @ 2023-04-26 14:00 UTC (permalink / raw)
  To: FFmpeg development discussions and patches

[-- Attachment #1: Type: text/plain, Size: 4636 bytes --]

Connected FFmpeg to Mediacodec VP8 encoder
---
configure                       |  1 +
libavcodec/Makefile             |  1 +
libavcodec/allcodecs.c          |  1 +
libavcodec/mediacodec_wrapper.c |  4 ++++
libavcodec/mediacodecenc.c      | 29 +++++++++++++++++++++++++++++
5 files changed, 36 insertions(+)

diff --git a/configure b/configure
index 0a60deac65..a54398c57f 100755
--- a/configure
+++ b/configure
@@ -3240,6 +3240,7 @@ vc1_qsv_decoder_select="qsvdec"
vc1_v4l2m2m_decoder_deps="v4l2_m2m vc1_v4l2_m2m"
vp8_cuvid_decoder_deps="cuvid"
vp8_mediacodec_decoder_deps="mediacodec"
+vp8_mediacodec_encoder_deps="mediacodec"
vp8_qsv_decoder_select="qsvdec"
vp8_rkmpp_decoder_deps="rkmpp"
vp8_vaapi_encoder_deps="VAEncPictureParameterBufferVP8"
diff --git a/libavcodec/Makefile b/libavcodec/Makefile
index 166f77f12a..aacea4f4b6 100644
--- a/libavcodec/Makefile
+++ b/libavcodec/Makefile
@@ -767,6 +767,7 @@ OBJS-$(CONFIG_VP7_DECODER)             += vp8.o vpx_rac.o
OBJS-$(CONFIG_VP8_DECODER)             += vp8.o vpx_rac.o
OBJS-$(CONFIG_VP8_CUVID_DECODER)       += cuviddec.o
OBJS-$(CONFIG_VP8_MEDIACODEC_DECODER)  += mediacodecdec.o
+OBJS-$(CONFIG_VP8_MEDIACODEC_ENCODER)  += mediacodecenc.o
OBJS-$(CONFIG_VP8_QSV_DECODER)         += qsvdec.o
OBJS-$(CONFIG_VP8_RKMPP_DECODER)       += rkmppdec.o
OBJS-$(CONFIG_VP8_VAAPI_ENCODER)       += vaapi_encode_vp8.o
diff --git a/libavcodec/allcodecs.c b/libavcodec/allcodecs.c
index f583aad860..184bb8521f 100644
--- a/libavcodec/allcodecs.c
+++ b/libavcodec/allcodecs.c
@@ -881,6 +881,7 @@ extern const FFCodec ff_prores_videotoolbox_encoder;
extern const FFCodec ff_vc1_cuvid_decoder;
extern const FFCodec ff_vp8_cuvid_decoder;
extern const FFCodec ff_vp8_mediacodec_decoder;
+extern const FFCodec ff_vp8_mediacodec_encoder;
extern const FFCodec ff_vp8_qsv_decoder;
extern const FFCodec ff_vp8_v4l2m2m_encoder;
extern const FFCodec ff_vp8_vaapi_encoder;
diff --git a/libavcodec/mediacodec_wrapper.c b/libavcodec/mediacodec_wrapper.c
index 015f275a0f..b088cd2945 100644
--- a/libavcodec/mediacodec_wrapper.c
+++ b/libavcodec/mediacodec_wrapper.c
@@ -321,6 +321,8 @@ int ff_AMediaCodecProfile_getProfileFromAVCodecContext(AVCodecContext *avctx)
     static const int HEVCProfileMain10HDR10 = 0x1000;
     static const int HEVCProfileMain10HDR10Plus = 0x2000;
+    static const int VP8ProfileMain = 0x01;
+
     static const int VP9Profile0 = 0x01;
     static const int VP9Profile1 = 0x02;
     static const int VP9Profile2 = 0x04;
@@ -396,6 +398,8 @@ int ff_AMediaCodecProfile_getProfileFromAVCodecContext(AVCodecContext *avctx)
         case FF_PROFILE_HEVC_MAIN_10:
             return HEVCProfileMain10;
         }
+    } else if (avctx->codec_id == AV_CODEC_ID_VP8) {
+        return VP8ProfileMain;
     } else if (avctx->codec_id == AV_CODEC_ID_VP9) {
         switch (avctx->profile) {
         case FF_PROFILE_VP9_0:
diff --git a/libavcodec/mediacodecenc.c b/libavcodec/mediacodecenc.c
index 10da43c3e7..ff28d5f14a 100644
--- a/libavcodec/mediacodecenc.c
+++ b/libavcodec/mediacodecenc.c
@@ -164,6 +164,9 @@ static av_cold int mediacodec_init(AVCodecContext *avctx)
     case AV_CODEC_ID_HEVC:
         codec_mime = "video/hevc";
         break;
+    case AV_CODEC_ID_VP8:
+        codec_mime = "video/x-vnd.on2.vp8";
+        break;
     case AV_CODEC_ID_VP9:
         codec_mime = "video/x-vnd.on2.vp9";
         break;
@@ -778,6 +781,32 @@ DECLARE_MEDIACODEC_ENCODER(hevc, "H.265", AV_CODEC_ID_HEVC)
 #endif  // CONFIG_HEVC_MEDIACODEC_ENCODER
+#if CONFIG_VP8_MEDIACODEC_ENCODER
+
+enum MediaCodecVP8Level {
+    VP8Level_Version0 = 0x01,
+    VP8Level_Version1 = 0x02,
+    VP8Level_Version2 = 0x04,
+    VP8Level_Version3 = 0x08,
+};
+
+static const AVOption vp8_options[] = {
+    COMMON_OPTION
+    { "level", "Specify tier and level",
+                OFFSET(level), AV_OPT_TYPE_INT, {.i64 = 0}, 0, INT_MAX, VE, "level" },
+    { "V0",    "Level Version 0",
+                0, AV_OPT_TYPE_CONST, { .i64 = VP8Level_Version0 },  0, 0, VE,  "level" },
+    { "V1",    "Level Version 1",
+                0, AV_OPT_TYPE_CONST, { .i64 = VP8Level_Version1 },  0, 0, VE,  "level" },
+    { "V2",    "Level Version 2",
+                0, AV_OPT_TYPE_CONST, { .i64 = VP8Level_Version2 },  0, 0, VE,  "level" },
+    { "V3",    "Level Version 3",
+                0, AV_OPT_TYPE_CONST, { .i64 = VP8Level_Version3 },  0, 0, VE,  "level" },
+    { NULL, }
+};
+
+#endif  // CONFIG_VP8_MEDIACODEC_ENCODER
+
#if CONFIG_VP9_MEDIACODEC_ENCODER
 enum MediaCodecVP9Level {
--



[-- Attachment #2: avcodec-mediacodec-add-vp8.patch.b64 --]
[-- Type: application/octet-stream, Size: 6452 bytes --]

[-- Attachment #3: Type: text/plain, Size: 251 bytes --]

_______________________________________________
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] 7+ messages in thread

* Re: [FFmpeg-devel] [PATCH] avcodec/mediacodec: Add VP8 encoder
  2023-04-26 14:00 [FFmpeg-devel] [PATCH] avcodec/mediacodec: Add VP8 encoder Samuel Raposo Vieira Mira
@ 2023-04-27 12:36 ` Tomas Härdin
  0 siblings, 0 replies; 7+ messages in thread
From: Tomas Härdin @ 2023-04-27 12:36 UTC (permalink / raw)
  To: FFmpeg development discussions and patches

ons 2023-04-26 klockan 14:00 +0000 skrev Samuel Raposo Vieira Mira:
> Connected FFmpeg to Mediacodec VP8 encoder
> ---
> configure                       |  1 +
> libavcodec/Makefile             |  1 +
> libavcodec/allcodecs.c          |  1 +
> libavcodec/mediacodec_wrapper.c |  4 ++++
> libavcodec/mediacodecenc.c      | 29 +++++++++++++++++++++++++++++
> 5 files changed, 36 insertions(+)

Needs a minor version bump I think.

/Tomas

_______________________________________________
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] 7+ messages in thread

* Re: [FFmpeg-devel] [PATCH] avcodec/mediacodec: Add VP8 encoder
  2023-05-16 16:16   ` Samuel Raposo Vieira Mira
@ 2023-05-16 17:02     ` Zhao Zhili
  0 siblings, 0 replies; 7+ messages in thread
From: Zhao Zhili @ 2023-05-16 17:02 UTC (permalink / raw)
  To: 'FFmpeg development discussions and patches'


> From: ffmpeg-devel <ffmpeg-devel-bounces@ffmpeg.org> On Behalf Of Samuel Raposo Vieira Mira
> Sent: 2023年5月17日 0:16
> To: FFmpeg development discussions and patches <ffmpeg-devel@ffmpeg.org>
> Subject: Re: [FFmpeg-devel] [PATCH] avcodec/mediacodec: Add VP8 encoder
> 
> > > Connected FFmpeg to Mediacodec VP8 encoder.
> > > Minor Version bump.
> > ---
> > > configure                       |  1 +
> > > libavcodec/Makefile             |  1 +
> > > libavcodec/allcodecs.c          |  1 +
> > > libavcodec/mediacodec_wrapper.c |  4 ++++
> > > libavcodec/mediacodecenc.c      | 29 +++++++++++++++++++++++++++++
> > > libavcodec/version.h            |  2 +-
> > > 6 files changed, 37 insertions(+), 1 deletion(-)
> >
> > The patch file format is broken (missing a space before unchanged lines).
> > Please send it via git send-email or add the patch as attachment.
> 
> Thanks for noticing the issue! will send as patch next time.
> 
> > >
> > > @@ -387,6 +389,8 @@ int ff_AMediaCodecProfile_getProfileFromAVCodecContext(AVCodecContext *avctx)
> > >          case FF_PROFILE_HEVC_MAIN_10:
> > >              return HEVCProfileMain10;
> > >          }
> > > +    } else if (avctx->codec_id == AV_CODEC_ID_VP8) {
> > > +        return VP8ProfileMain;
> > >      } else if (avctx->codec_id == AV_CODEC_ID_VP9) {
> > >          switch (avctx->profile) {
> > >          case FF_PROFILE_VP9_0:
> >
> > The function is a map from avctx->profile to MediaCodec profile.
> > It's not supposed to select a default profile.
> 
> But there is no avctx->profile for VP8.
> Should I create an FF_PROFILE_VP8?

Since there is only one profile and unlikely to change in the future, it seems profile
is useless for VP8 decoder and encoder. I think we can just ignore/skip it for VP8.

> 
> 
> From: ffmpeg-devel <ffmpeg-devel-bounces@ffmpeg.org> on behalf of Zhao Zhili <quinkblack@foxmail.com>
> Date: Sunday, 7. May 2023 at 11.26
> To: Samuel Raposo Vieira Mira <samuel.mira@qt.io>, FFmpeg development discussions and patches <ffmpeg-devel@ffmpeg.org>
> Subject: Re: [FFmpeg-devel] [PATCH] avcodec/mediacodec: Add VP8 encoder
> On Fri, 2023-04-28 at 11:07 +0000, Samuel Raposo Vieira Mira wrote:
> > Connected FFmpeg to Mediacodec VP8 encoder.
> > Minor Version bump.
> > ---
> > configure                       |  1 +
> > libavcodec/Makefile             |  1 +
> > libavcodec/allcodecs.c          |  1 +
> > libavcodec/mediacodec_wrapper.c |  4 ++++
> > libavcodec/mediacodecenc.c      | 29 +++++++++++++++++++++++++++++
> > libavcodec/version.h            |  2 +-
> > 6 files changed, 37 insertions(+), 1 deletion(-)
> 
> The patch file format is broken (missing a space before unchanged lines).
> Please send it via git send-email or add the patch as attachment.
> 
> >
> > @@ -387,6 +389,8 @@ int ff_AMediaCodecProfile_getProfileFromAVCodecContext(AVCodecContext *avctx)
> >          case FF_PROFILE_HEVC_MAIN_10:
> >              return HEVCProfileMain10;
> >          }
> > +    } else if (avctx->codec_id == AV_CODEC_ID_VP8) {
> > +        return VP8ProfileMain;
> >      } else if (avctx->codec_id == AV_CODEC_ID_VP9) {
> >          switch (avctx->profile) {
> >          case FF_PROFILE_VP9_0:
> 
> The function is a map from avctx->profile to MediaCodec profile.
> It's not supposed to select a default profile.
> 
> _______________________________________________
> 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] 7+ messages in thread

* Re: [FFmpeg-devel] [PATCH] avcodec/mediacodec: Add VP8 encoder
  2023-05-07  8:26 ` Zhao Zhili
@ 2023-05-16 16:16   ` Samuel Raposo Vieira Mira
  2023-05-16 17:02     ` Zhao Zhili
  0 siblings, 1 reply; 7+ messages in thread
From: Samuel Raposo Vieira Mira @ 2023-05-16 16:16 UTC (permalink / raw)
  To: FFmpeg development discussions and patches

> > Connected FFmpeg to Mediacodec VP8 encoder.
> > Minor Version bump.
> ---
> > configure                       |  1 +
> > libavcodec/Makefile             |  1 +
> > libavcodec/allcodecs.c          |  1 +
> > libavcodec/mediacodec_wrapper.c |  4 ++++
> > libavcodec/mediacodecenc.c      | 29 +++++++++++++++++++++++++++++
> > libavcodec/version.h            |  2 +-
> > 6 files changed, 37 insertions(+), 1 deletion(-)
>
> The patch file format is broken (missing a space before unchanged lines).
> Please send it via git send-email or add the patch as attachment.

Thanks for noticing the issue! will send as patch next time.

> >
> > @@ -387,6 +389,8 @@ int ff_AMediaCodecProfile_getProfileFromAVCodecContext(AVCodecContext *avctx)
> >          case FF_PROFILE_HEVC_MAIN_10:
> >              return HEVCProfileMain10;
> >          }
> > +    } else if (avctx->codec_id == AV_CODEC_ID_VP8) {
> > +        return VP8ProfileMain;
> >      } else if (avctx->codec_id == AV_CODEC_ID_VP9) {
> >          switch (avctx->profile) {
> >          case FF_PROFILE_VP9_0:
>
> The function is a map from avctx->profile to MediaCodec profile.
> It's not supposed to select a default profile.

But there is no avctx->profile for VP8.
Should I create an FF_PROFILE_VP8?


From: ffmpeg-devel <ffmpeg-devel-bounces@ffmpeg.org> on behalf of Zhao Zhili <quinkblack@foxmail.com>
Date: Sunday, 7. May 2023 at 11.26
To: Samuel Raposo Vieira Mira <samuel.mira@qt.io>, FFmpeg development discussions and patches <ffmpeg-devel@ffmpeg.org>
Subject: Re: [FFmpeg-devel] [PATCH] avcodec/mediacodec: Add VP8 encoder
On Fri, 2023-04-28 at 11:07 +0000, Samuel Raposo Vieira Mira wrote:
> Connected FFmpeg to Mediacodec VP8 encoder.
> Minor Version bump.
> ---
> configure                       |  1 +
> libavcodec/Makefile             |  1 +
> libavcodec/allcodecs.c          |  1 +
> libavcodec/mediacodec_wrapper.c |  4 ++++
> libavcodec/mediacodecenc.c      | 29 +++++++++++++++++++++++++++++
> libavcodec/version.h            |  2 +-
> 6 files changed, 37 insertions(+), 1 deletion(-)

The patch file format is broken (missing a space before unchanged lines).
Please send it via git send-email or add the patch as attachment.

>
> @@ -387,6 +389,8 @@ int ff_AMediaCodecProfile_getProfileFromAVCodecContext(AVCodecContext *avctx)
>          case FF_PROFILE_HEVC_MAIN_10:
>              return HEVCProfileMain10;
>          }
> +    } else if (avctx->codec_id == AV_CODEC_ID_VP8) {
> +        return VP8ProfileMain;
>      } else if (avctx->codec_id == AV_CODEC_ID_VP9) {
>          switch (avctx->profile) {
>          case FF_PROFILE_VP9_0:

The function is a map from avctx->profile to MediaCodec profile.
It's not supposed to select a default profile.

_______________________________________________
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] 7+ messages in thread

* Re: [FFmpeg-devel] [PATCH] avcodec/mediacodec: Add VP8 encoder
  2023-04-28 11:07 Samuel Raposo Vieira Mira
  2023-05-02 11:39 ` Tomas Härdin
@ 2023-05-07  8:26 ` Zhao Zhili
  2023-05-16 16:16   ` Samuel Raposo Vieira Mira
  1 sibling, 1 reply; 7+ messages in thread
From: Zhao Zhili @ 2023-05-07  8:26 UTC (permalink / raw)
  To: Samuel Raposo Vieira Mira, FFmpeg development discussions and patches

On Fri, 2023-04-28 at 11:07 +0000, Samuel Raposo Vieira Mira wrote:
> Connected FFmpeg to Mediacodec VP8 encoder.
> Minor Version bump.
> ---
> configure                       |  1 +
> libavcodec/Makefile             |  1 +
> libavcodec/allcodecs.c          |  1 +
> libavcodec/mediacodec_wrapper.c |  4 ++++
> libavcodec/mediacodecenc.c      | 29 +++++++++++++++++++++++++++++
> libavcodec/version.h            |  2 +-
> 6 files changed, 37 insertions(+), 1 deletion(-)

The patch file format is broken (missing a space before unchanged lines).
Please send it via git send-email or add the patch as attachment.

> 
> @@ -387,6 +389,8 @@ int ff_AMediaCodecProfile_getProfileFromAVCodecContext(AVCodecContext *avctx)
>          case FF_PROFILE_HEVC_MAIN_10:
>              return HEVCProfileMain10;
>          }
> +    } else if (avctx->codec_id == AV_CODEC_ID_VP8) {
> +        return VP8ProfileMain;
>      } else if (avctx->codec_id == AV_CODEC_ID_VP9) {
>          switch (avctx->profile) {
>          case FF_PROFILE_VP9_0:

The function is a map from avctx->profile to MediaCodec profile.
It's not supposed to select a default profile.

_______________________________________________
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] 7+ messages in thread

* Re: [FFmpeg-devel] [PATCH] avcodec/mediacodec: Add VP8 encoder
  2023-04-28 11:07 Samuel Raposo Vieira Mira
@ 2023-05-02 11:39 ` Tomas Härdin
  2023-05-07  8:26 ` Zhao Zhili
  1 sibling, 0 replies; 7+ messages in thread
From: Tomas Härdin @ 2023-05-02 11:39 UTC (permalink / raw)
  To: FFmpeg development discussions and patches

fre 2023-04-28 klockan 11:07 +0000 skrev Samuel Raposo Vieira Mira:
> 
> Connected FFmpeg to Mediacodec VP8 encoder.
> Minor Version bump.
> ---
> configure                       |  1 +
> libavcodec/Makefile             |  1 +
> libavcodec/allcodecs.c          |  1 +
> libavcodec/mediacodec_wrapper.c |  4 ++++
> libavcodec/mediacodecenc.c      | 29 +++++++++++++++++++++++++++++
> libavcodec/version.h            |  2 +-
> 6 files changed, 37 insertions(+), 1 deletion(-)

Looks OK but maybe Zhao wants to chime in?

/Tomas

_______________________________________________
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] 7+ messages in thread

* [FFmpeg-devel] [PATCH] avcodec/mediacodec: Add VP8 encoder
@ 2023-04-28 11:07 Samuel Raposo Vieira Mira
  2023-05-02 11:39 ` Tomas Härdin
  2023-05-07  8:26 ` Zhao Zhili
  0 siblings, 2 replies; 7+ messages in thread
From: Samuel Raposo Vieira Mira @ 2023-04-28 11:07 UTC (permalink / raw)
  To: FFmpeg development discussions and patches

[-- Attachment #1: Type: text/plain, Size: 5128 bytes --]


Connected FFmpeg to Mediacodec VP8 encoder.
Minor Version bump.
---
configure                       |  1 +
libavcodec/Makefile             |  1 +
libavcodec/allcodecs.c          |  1 +
libavcodec/mediacodec_wrapper.c |  4 ++++
libavcodec/mediacodecenc.c      | 29 +++++++++++++++++++++++++++++
libavcodec/version.h            |  2 +-
6 files changed, 37 insertions(+), 1 deletion(-)

diff --git a/configure b/configure
index bb7be67676..1aef227cd4 100755
--- a/configure
+++ b/configure
@@ -3239,6 +3239,7 @@ vc1_qsv_decoder_select="qsvdec"
vc1_v4l2m2m_decoder_deps="v4l2_m2m vc1_v4l2_m2m"
vp8_cuvid_decoder_deps="cuvid"
vp8_mediacodec_decoder_deps="mediacodec"
+vp8_mediacodec_encoder_deps="mediacodec"
vp8_qsv_decoder_select="qsvdec"
vp8_rkmpp_decoder_deps="rkmpp"
vp8_vaapi_encoder_deps="VAEncPictureParameterBufferVP8"
diff --git a/libavcodec/Makefile b/libavcodec/Makefile
index b0971ce833..512d5bd1b0 100644
--- a/libavcodec/Makefile
+++ b/libavcodec/Makefile
@@ -766,6 +766,7 @@ OBJS-$(CONFIG_VP7_DECODER)             += vp8.o vpx_rac.o
OBJS-$(CONFIG_VP8_DECODER)             += vp8.o vpx_rac.o
OBJS-$(CONFIG_VP8_CUVID_DECODER)       += cuviddec.o
OBJS-$(CONFIG_VP8_MEDIACODEC_DECODER)  += mediacodecdec.o
+OBJS-$(CONFIG_VP8_MEDIACODEC_ENCODER)  += mediacodecenc.o
OBJS-$(CONFIG_VP8_QSV_DECODER)         += qsvdec.o
OBJS-$(CONFIG_VP8_RKMPP_DECODER)       += rkmppdec.o
OBJS-$(CONFIG_VP8_VAAPI_ENCODER)       += vaapi_encode_vp8.o
diff --git a/libavcodec/allcodecs.c b/libavcodec/allcodecs.c
index 8eeed34e57..2e37db69fa 100644
--- a/libavcodec/allcodecs.c
+++ b/libavcodec/allcodecs.c
@@ -880,6 +880,7 @@ extern const FFCodec ff_prores_videotoolbox_encoder;
extern const FFCodec ff_vc1_cuvid_decoder;
extern const FFCodec ff_vp8_cuvid_decoder;
extern const FFCodec ff_vp8_mediacodec_decoder;
+extern const FFCodec ff_vp8_mediacodec_encoder;
extern const FFCodec ff_vp8_qsv_decoder;
extern const FFCodec ff_vp8_v4l2m2m_encoder;
extern const FFCodec ff_vp8_vaapi_encoder;
diff --git a/libavcodec/mediacodec_wrapper.c b/libavcodec/mediacodec_wrapper.c
index 1c29bb7406..8619735bfc 100644
--- a/libavcodec/mediacodec_wrapper.c
+++ b/libavcodec/mediacodec_wrapper.c
@@ -319,6 +319,8 @@ int ff_AMediaCodecProfile_getProfileFromAVCodecContext(AVCodecContext *avctx)
     static const int HEVCProfileMain10HDR10 = 0x1000;
     static const int HEVCProfileMain10HDR10Plus = 0x2000;

+    static const int VP8ProfileMain = 0x01;
+
     static const int VP9Profile0 = 0x01;
     static const int VP9Profile1 = 0x02;
     static const int VP9Profile2 = 0x04;
@@ -387,6 +389,8 @@ int ff_AMediaCodecProfile_getProfileFromAVCodecContext(AVCodecContext *avctx)
         case FF_PROFILE_HEVC_MAIN_10:
             return HEVCProfileMain10;
         }
+    } else if (avctx->codec_id == AV_CODEC_ID_VP8) {
+        return VP8ProfileMain;
     } else if (avctx->codec_id == AV_CODEC_ID_VP9) {
         switch (avctx->profile) {
         case FF_PROFILE_VP9_0:
diff --git a/libavcodec/mediacodecenc.c b/libavcodec/mediacodecenc.c
index e4b583a542..6f80dbb4a5 100644
--- a/libavcodec/mediacodecenc.c
+++ b/libavcodec/mediacodecenc.c
@@ -164,6 +164,9 @@ static av_cold int mediacodec_init(AVCodecContext *avctx)
     case AV_CODEC_ID_HEVC:
         codec_mime = "video/hevc";
         break;
+    case AV_CODEC_ID_VP8:
+        codec_mime = "video/x-vnd.on2.vp8";
+        break;
     case AV_CODEC_ID_VP9:
         codec_mime = "video/x-vnd.on2.vp9";
         break;
@@ -775,6 +778,32 @@ DECLARE_MEDIACODEC_ENCODER(hevc, "H.265", AV_CODEC_ID_HEVC)

#endif  // CONFIG_HEVC_MEDIACODEC_ENCODER

+#if CONFIG_VP8_MEDIACODEC_ENCODER
+
+enum MediaCodecVP8Level {
+    VP8Level_Version0 = 0x01,
+    VP8Level_Version1 = 0x02,
+    VP8Level_Version2 = 0x04,
+    VP8Level_Version3 = 0x08,
+};
+
+static const AVOption vp8_options[] = {
+    COMMON_OPTION
+    { "level", "Specify tier and level",
+                OFFSET(level), AV_OPT_TYPE_INT, {.i64 = 0}, 0, INT_MAX, VE, "level" },
+    { "V0",    "Level Version 0",
+                0, AV_OPT_TYPE_CONST, { .i64 = VP8Level_Version0 },  0, 0, VE,  "level" },
+    { "V1",    "Level Version 1",
+                0, AV_OPT_TYPE_CONST, { .i64 = VP8Level_Version1 },  0, 0, VE,  "level" },
+    { "V2",    "Level Version 2",
+                0, AV_OPT_TYPE_CONST, { .i64 = VP8Level_Version2 },  0, 0, VE,  "level" },
+    { "V3",    "Level Version 3",
+                0, AV_OPT_TYPE_CONST, { .i64 = VP8Level_Version3 },  0, 0, VE,  "level" },
+    { NULL, }
+};
+
+#endif  // CONFIG_VP8_MEDIACODEC_ENCODER
+
#if CONFIG_VP9_MEDIACODEC_ENCODER

enum MediaCodecVP9Level {
diff --git a/libavcodec/version.h b/libavcodec/version.h
index 80e2ae630d..8b53586be1 100644
--- a/libavcodec/version.h
+++ b/libavcodec/version.h
@@ -29,7 +29,7 @@

#include "version_major.h"

-#define LIBAVCODEC_VERSION_MINOR  10
+#define LIBAVCODEC_VERSION_MINOR  11
#define LIBAVCODEC_VERSION_MICRO 100

#define LIBAVCODEC_VERSION_INT  AV_VERSION_INT(LIBAVCODEC_VERSION_MAJOR, \
--
2.35.2




[-- Attachment #2: 0001-avcodec-mediacodec-Add-VP8-encoder.patch.b64 --]
[-- Type: application/octet-stream, Size: 7085 bytes --]

[-- Attachment #3: 0001-avcodec-mediacodec-Add-VP8-encoder.patch --]
[-- Type: application/octet-stream, Size: 5230 bytes --]

[-- Attachment #4: Type: text/plain, Size: 251 bytes --]

_______________________________________________
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] 7+ messages in thread

end of thread, other threads:[~2023-05-16 17:03 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-04-26 14:00 [FFmpeg-devel] [PATCH] avcodec/mediacodec: Add VP8 encoder Samuel Raposo Vieira Mira
2023-04-27 12:36 ` Tomas Härdin
2023-04-28 11:07 Samuel Raposo Vieira Mira
2023-05-02 11:39 ` Tomas Härdin
2023-05-07  8:26 ` Zhao Zhili
2023-05-16 16:16   ` Samuel Raposo Vieira Mira
2023-05-16 17:02     ` Zhao Zhili

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