From 6c6bb9873f55853fe74d8f45ad3ae116636d8be7 Mon Sep 17 00:00:00 2001 From: Kunter Gultekin Date: Fri, 1 Feb 2013 17:01:15 +0200 Subject: Adds VPX encoding support for stagefright. Only following encoder settings are available - target bitrate - rate control (constant / variable) - frame rate - token partitioning - error resilience - reconstruction & loop filters Only following color formats are recognized - YUV420Planar - YUV420SemiPlanar - AndroidOpaque Following settings are not configurable by the client - encoding deadline is realtime - the algorithm interface for encoder is vp8 - fractional bits of frame rate is discarded - timebase is fixed to 1/1000000 Requires libvpx to be built with encoder support enabled. Requires openmax 1.1.2 extension headers. Relevant tests exist in cts repo. Change-Id: If759edb8db36acbd24dcb53d159a54e942766020 Signed-off-by: Kunter Gultekin --- .../libstagefright/codecs/on2/enc/SoftVPXEncoder.h | 203 +++++++++++++++++++++ 1 file changed, 203 insertions(+) create mode 100644 media/libstagefright/codecs/on2/enc/SoftVPXEncoder.h (limited to 'media/libstagefright/codecs/on2/enc/SoftVPXEncoder.h') diff --git a/media/libstagefright/codecs/on2/enc/SoftVPXEncoder.h b/media/libstagefright/codecs/on2/enc/SoftVPXEncoder.h new file mode 100644 index 0000000..3bc05c0 --- /dev/null +++ b/media/libstagefright/codecs/on2/enc/SoftVPXEncoder.h @@ -0,0 +1,203 @@ +/* + * Copyright (C) 2013 The Android Open Source Project + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#ifndef SOFT_VPX_ENCODER_H_ + +#define SOFT_VPX_ENCODER_H_ + +#include "SimpleSoftOMXComponent.h" + +#include +#include + +#include "vpx/vpx_encoder.h" +#include "vpx/vpx_codec.h" +#include "vpx/vp8cx.h" + +namespace android { + +// Exposes a vpx encoder as an OMX Component +// +// Boilerplate for callback bindings are taken care +// by the base class SimpleSoftOMXComponent and its +// parent SoftOMXComponent. +// +// Only following encoder settings are available +// - target bitrate +// - rate control (constant / variable) +// - frame rate +// - error resilience +// - token partitioning +// - reconstruction & loop filters (g_profile) +// +// Only following color formats are recognized +// - YUV420Planar +// - YUV420SemiPlanar +// - AndroidOpaque +// +// Following settings are not configurable by the client +// - encoding deadline is realtime +// - multithreaded encoding utilizes a number of threads equal +// to online cpu's available +// - the algorithm interface for encoder is vp8 +// - fractional bits of frame rate is discarded +// - OMX timestamps are in microseconds, therefore +// encoder timebase is fixed to 1/1000000 + +class SoftVPXEncoder : public SimpleSoftOMXComponent { + public: + SoftVPXEncoder(const char *name, + const OMX_CALLBACKTYPE *callbacks, + OMX_PTR appData, + OMX_COMPONENTTYPE **component); + + protected: + virtual ~SoftVPXEncoder(); + + // Returns current values for requested OMX + // parameters + virtual OMX_ERRORTYPE internalGetParameter( + OMX_INDEXTYPE index, OMX_PTR param); + + // Validates, extracts and stores relevant OMX + // parameters + virtual OMX_ERRORTYPE internalSetParameter( + OMX_INDEXTYPE index, const OMX_PTR param); + + // OMX callback when buffers available + // Note that both an input and output buffer + // is expected to be available to carry out + // encoding of the frame + virtual void onQueueFilled(OMX_U32 portIndex); + + private: + // number of buffers allocated per port + static const uint32_t kNumBuffers = 4; + + // OMX port indexes that refer to input and + // output ports respectively + static const uint32_t kInputPortIndex = 0; + static const uint32_t kOutputPortIndex = 1; + + // Byte-alignment required for buffers + static const uint32_t kInputBufferAlignment = 1; + static const uint32_t kOutputBufferAlignment = 2; + + // Max value supported for DCT partitions + static const uint32_t kMaxDCTPartitions = 3; + + // Number of supported input color formats + static const uint32_t kNumberOfSupportedColorFormats = 3; + + // vpx specific opaque data structure that + // stores encoder state + vpx_codec_ctx_t* mCodecContext; + + // vpx specific data structure that + // stores encoder configuration + vpx_codec_enc_cfg_t* mCodecConfiguration; + + // vpx specific read-only data structure + // that specifies algorithm interface (e.g. vp8) + vpx_codec_iface_t* mCodecInterface; + + // Width of the input frames + int32_t mWidth; + + // Height of the input frames + int32_t mHeight; + + // Target bitrate set for the encoder, in bits per second. + int32_t mBitrate; + + // Bitrate control mode, either constant or variable + vpx_rc_mode mBitrateControlMode; + + // Frame duration is the reciprocal of framerate, denoted + // in microseconds + uint64_t mFrameDurationUs; + + // vp8 specific configuration parameter + // that enables token partitioning of + // the stream into substreams + int32_t mDCTPartitions; + + // Parameter that denotes whether error resilience + // is enabled in encoder + OMX_BOOL mErrorResilience; + + // Color format for the input port + OMX_COLOR_FORMATTYPE mColorFormat; + + // Encoder profile corresponding to OMX level parameter + // + // The inconsistency in the naming is caused by + // OMX spec referring vpx profiles (g_profile) + // as "levels" whereas using the name "profile" for + // something else. + OMX_VIDEO_VP8LEVELTYPE mLevel; + + // Conversion buffer is needed to convert semi + // planar yuv420 to planar format + // It is only allocated if input format is + // indeed YUV420SemiPlanar. + uint8_t* mConversionBuffer; + + // Initializes input and output OMX ports with sensible + // default values. + void initPorts(); + + // Initializes vpx encoder with available settings. + status_t initEncoder(); + + // Releases vpx encoder instance, with it's associated + // data structures. + // + // Unless called earlier, this is handled by the + // dtor. + status_t releaseEncoder(); + + // Handles port changes with respect to color formats + OMX_ERRORTYPE internalSetFormatParams( + const OMX_VIDEO_PARAM_PORTFORMATTYPE* format); + + // Verifies the component role tried to be set to this OMX component is + // strictly video_encoder.vpx + OMX_ERRORTYPE internalSetRoleParams( + const OMX_PARAM_COMPONENTROLETYPE* role); + + // Updates bitrate to reflect port settings. + OMX_ERRORTYPE internalSetBitrateParams( + const OMX_VIDEO_PARAM_BITRATETYPE* bitrate); + + // Handles port definition changes. + OMX_ERRORTYPE internalSetPortParams( + const OMX_PARAM_PORTDEFINITIONTYPE* port); + + // Handles vp8 specific parameters. + OMX_ERRORTYPE internalSetVp8Params( + const OMX_VIDEO_PARAM_VP8TYPE* vp8Params); + + // Updates encoder profile + OMX_ERRORTYPE internalSetProfileLevel( + const OMX_VIDEO_PARAM_PROFILELEVELTYPE* profileAndLevel); + + DISALLOW_EVIL_CONSTRUCTORS(SoftVPXEncoder); +}; + +} // namespace android + +#endif // SOFT_VPX_ENCODER_H_ -- cgit v1.1 From 513b8b238caa52f8ddf5c85109dbf362c515185f Mon Sep 17 00:00:00 2001 From: James Dong Date: Fri, 8 Feb 2013 18:16:02 -0800 Subject: Revert "Adds VPX encoding support for stagefright." This lib was not part of the build, but it is built anyway for userdebug image (not for eng though). let me revert it for now... This reverts commit 6c6bb9873f55853fe74d8f45ad3ae116636d8be7. --- .../libstagefright/codecs/on2/enc/SoftVPXEncoder.h | 203 --------------------- 1 file changed, 203 deletions(-) delete mode 100644 media/libstagefright/codecs/on2/enc/SoftVPXEncoder.h (limited to 'media/libstagefright/codecs/on2/enc/SoftVPXEncoder.h') diff --git a/media/libstagefright/codecs/on2/enc/SoftVPXEncoder.h b/media/libstagefright/codecs/on2/enc/SoftVPXEncoder.h deleted file mode 100644 index 3bc05c0..0000000 --- a/media/libstagefright/codecs/on2/enc/SoftVPXEncoder.h +++ /dev/null @@ -1,203 +0,0 @@ -/* - * Copyright (C) 2013 The Android Open Source Project - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -#ifndef SOFT_VPX_ENCODER_H_ - -#define SOFT_VPX_ENCODER_H_ - -#include "SimpleSoftOMXComponent.h" - -#include -#include - -#include "vpx/vpx_encoder.h" -#include "vpx/vpx_codec.h" -#include "vpx/vp8cx.h" - -namespace android { - -// Exposes a vpx encoder as an OMX Component -// -// Boilerplate for callback bindings are taken care -// by the base class SimpleSoftOMXComponent and its -// parent SoftOMXComponent. -// -// Only following encoder settings are available -// - target bitrate -// - rate control (constant / variable) -// - frame rate -// - error resilience -// - token partitioning -// - reconstruction & loop filters (g_profile) -// -// Only following color formats are recognized -// - YUV420Planar -// - YUV420SemiPlanar -// - AndroidOpaque -// -// Following settings are not configurable by the client -// - encoding deadline is realtime -// - multithreaded encoding utilizes a number of threads equal -// to online cpu's available -// - the algorithm interface for encoder is vp8 -// - fractional bits of frame rate is discarded -// - OMX timestamps are in microseconds, therefore -// encoder timebase is fixed to 1/1000000 - -class SoftVPXEncoder : public SimpleSoftOMXComponent { - public: - SoftVPXEncoder(const char *name, - const OMX_CALLBACKTYPE *callbacks, - OMX_PTR appData, - OMX_COMPONENTTYPE **component); - - protected: - virtual ~SoftVPXEncoder(); - - // Returns current values for requested OMX - // parameters - virtual OMX_ERRORTYPE internalGetParameter( - OMX_INDEXTYPE index, OMX_PTR param); - - // Validates, extracts and stores relevant OMX - // parameters - virtual OMX_ERRORTYPE internalSetParameter( - OMX_INDEXTYPE index, const OMX_PTR param); - - // OMX callback when buffers available - // Note that both an input and output buffer - // is expected to be available to carry out - // encoding of the frame - virtual void onQueueFilled(OMX_U32 portIndex); - - private: - // number of buffers allocated per port - static const uint32_t kNumBuffers = 4; - - // OMX port indexes that refer to input and - // output ports respectively - static const uint32_t kInputPortIndex = 0; - static const uint32_t kOutputPortIndex = 1; - - // Byte-alignment required for buffers - static const uint32_t kInputBufferAlignment = 1; - static const uint32_t kOutputBufferAlignment = 2; - - // Max value supported for DCT partitions - static const uint32_t kMaxDCTPartitions = 3; - - // Number of supported input color formats - static const uint32_t kNumberOfSupportedColorFormats = 3; - - // vpx specific opaque data structure that - // stores encoder state - vpx_codec_ctx_t* mCodecContext; - - // vpx specific data structure that - // stores encoder configuration - vpx_codec_enc_cfg_t* mCodecConfiguration; - - // vpx specific read-only data structure - // that specifies algorithm interface (e.g. vp8) - vpx_codec_iface_t* mCodecInterface; - - // Width of the input frames - int32_t mWidth; - - // Height of the input frames - int32_t mHeight; - - // Target bitrate set for the encoder, in bits per second. - int32_t mBitrate; - - // Bitrate control mode, either constant or variable - vpx_rc_mode mBitrateControlMode; - - // Frame duration is the reciprocal of framerate, denoted - // in microseconds - uint64_t mFrameDurationUs; - - // vp8 specific configuration parameter - // that enables token partitioning of - // the stream into substreams - int32_t mDCTPartitions; - - // Parameter that denotes whether error resilience - // is enabled in encoder - OMX_BOOL mErrorResilience; - - // Color format for the input port - OMX_COLOR_FORMATTYPE mColorFormat; - - // Encoder profile corresponding to OMX level parameter - // - // The inconsistency in the naming is caused by - // OMX spec referring vpx profiles (g_profile) - // as "levels" whereas using the name "profile" for - // something else. - OMX_VIDEO_VP8LEVELTYPE mLevel; - - // Conversion buffer is needed to convert semi - // planar yuv420 to planar format - // It is only allocated if input format is - // indeed YUV420SemiPlanar. - uint8_t* mConversionBuffer; - - // Initializes input and output OMX ports with sensible - // default values. - void initPorts(); - - // Initializes vpx encoder with available settings. - status_t initEncoder(); - - // Releases vpx encoder instance, with it's associated - // data structures. - // - // Unless called earlier, this is handled by the - // dtor. - status_t releaseEncoder(); - - // Handles port changes with respect to color formats - OMX_ERRORTYPE internalSetFormatParams( - const OMX_VIDEO_PARAM_PORTFORMATTYPE* format); - - // Verifies the component role tried to be set to this OMX component is - // strictly video_encoder.vpx - OMX_ERRORTYPE internalSetRoleParams( - const OMX_PARAM_COMPONENTROLETYPE* role); - - // Updates bitrate to reflect port settings. - OMX_ERRORTYPE internalSetBitrateParams( - const OMX_VIDEO_PARAM_BITRATETYPE* bitrate); - - // Handles port definition changes. - OMX_ERRORTYPE internalSetPortParams( - const OMX_PARAM_PORTDEFINITIONTYPE* port); - - // Handles vp8 specific parameters. - OMX_ERRORTYPE internalSetVp8Params( - const OMX_VIDEO_PARAM_VP8TYPE* vp8Params); - - // Updates encoder profile - OMX_ERRORTYPE internalSetProfileLevel( - const OMX_VIDEO_PARAM_PROFILELEVELTYPE* profileAndLevel); - - DISALLOW_EVIL_CONSTRUCTORS(SoftVPXEncoder); -}; - -} // namespace android - -#endif // SOFT_VPX_ENCODER_H_ -- cgit v1.1 From b4698f79230bbee15936641d951d49655f9e6da5 Mon Sep 17 00:00:00 2001 From: Kunter Gultekin Date: Fri, 1 Feb 2013 17:01:15 +0200 Subject: Adds VPX encoding support for stagefright. Only following encoder settings are available - target bitrate - rate control (constant / variable) - frame rate - token partitioning - error resilience - reconstruction & loop filters Only following color formats are recognized - YUV420Planar - YUV420SemiPlanar - AndroidOpaque Following settings are not configurable by the client - encoding deadline is realtime - the algorithm interface for encoder is vp8 - fractional bits of frame rate is discarded - timebase is fixed to 1/1000000 Requires libvpx to be built with encoder support enabled. Requires openmax 1.1.2 extension headers. Relevant tests exist in cts repo. Change-Id: I650f1aca83e7dc93f79d7e6cba7ac24f26e66d40 Signed-off-by: Kunter Gultekin --- .../libstagefright/codecs/on2/enc/SoftVPXEncoder.h | 203 +++++++++++++++++++++ 1 file changed, 203 insertions(+) create mode 100644 media/libstagefright/codecs/on2/enc/SoftVPXEncoder.h (limited to 'media/libstagefright/codecs/on2/enc/SoftVPXEncoder.h') diff --git a/media/libstagefright/codecs/on2/enc/SoftVPXEncoder.h b/media/libstagefright/codecs/on2/enc/SoftVPXEncoder.h new file mode 100644 index 0000000..3bc05c0 --- /dev/null +++ b/media/libstagefright/codecs/on2/enc/SoftVPXEncoder.h @@ -0,0 +1,203 @@ +/* + * Copyright (C) 2013 The Android Open Source Project + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#ifndef SOFT_VPX_ENCODER_H_ + +#define SOFT_VPX_ENCODER_H_ + +#include "SimpleSoftOMXComponent.h" + +#include +#include + +#include "vpx/vpx_encoder.h" +#include "vpx/vpx_codec.h" +#include "vpx/vp8cx.h" + +namespace android { + +// Exposes a vpx encoder as an OMX Component +// +// Boilerplate for callback bindings are taken care +// by the base class SimpleSoftOMXComponent and its +// parent SoftOMXComponent. +// +// Only following encoder settings are available +// - target bitrate +// - rate control (constant / variable) +// - frame rate +// - error resilience +// - token partitioning +// - reconstruction & loop filters (g_profile) +// +// Only following color formats are recognized +// - YUV420Planar +// - YUV420SemiPlanar +// - AndroidOpaque +// +// Following settings are not configurable by the client +// - encoding deadline is realtime +// - multithreaded encoding utilizes a number of threads equal +// to online cpu's available +// - the algorithm interface for encoder is vp8 +// - fractional bits of frame rate is discarded +// - OMX timestamps are in microseconds, therefore +// encoder timebase is fixed to 1/1000000 + +class SoftVPXEncoder : public SimpleSoftOMXComponent { + public: + SoftVPXEncoder(const char *name, + const OMX_CALLBACKTYPE *callbacks, + OMX_PTR appData, + OMX_COMPONENTTYPE **component); + + protected: + virtual ~SoftVPXEncoder(); + + // Returns current values for requested OMX + // parameters + virtual OMX_ERRORTYPE internalGetParameter( + OMX_INDEXTYPE index, OMX_PTR param); + + // Validates, extracts and stores relevant OMX + // parameters + virtual OMX_ERRORTYPE internalSetParameter( + OMX_INDEXTYPE index, const OMX_PTR param); + + // OMX callback when buffers available + // Note that both an input and output buffer + // is expected to be available to carry out + // encoding of the frame + virtual void onQueueFilled(OMX_U32 portIndex); + + private: + // number of buffers allocated per port + static const uint32_t kNumBuffers = 4; + + // OMX port indexes that refer to input and + // output ports respectively + static const uint32_t kInputPortIndex = 0; + static const uint32_t kOutputPortIndex = 1; + + // Byte-alignment required for buffers + static const uint32_t kInputBufferAlignment = 1; + static const uint32_t kOutputBufferAlignment = 2; + + // Max value supported for DCT partitions + static const uint32_t kMaxDCTPartitions = 3; + + // Number of supported input color formats + static const uint32_t kNumberOfSupportedColorFormats = 3; + + // vpx specific opaque data structure that + // stores encoder state + vpx_codec_ctx_t* mCodecContext; + + // vpx specific data structure that + // stores encoder configuration + vpx_codec_enc_cfg_t* mCodecConfiguration; + + // vpx specific read-only data structure + // that specifies algorithm interface (e.g. vp8) + vpx_codec_iface_t* mCodecInterface; + + // Width of the input frames + int32_t mWidth; + + // Height of the input frames + int32_t mHeight; + + // Target bitrate set for the encoder, in bits per second. + int32_t mBitrate; + + // Bitrate control mode, either constant or variable + vpx_rc_mode mBitrateControlMode; + + // Frame duration is the reciprocal of framerate, denoted + // in microseconds + uint64_t mFrameDurationUs; + + // vp8 specific configuration parameter + // that enables token partitioning of + // the stream into substreams + int32_t mDCTPartitions; + + // Parameter that denotes whether error resilience + // is enabled in encoder + OMX_BOOL mErrorResilience; + + // Color format for the input port + OMX_COLOR_FORMATTYPE mColorFormat; + + // Encoder profile corresponding to OMX level parameter + // + // The inconsistency in the naming is caused by + // OMX spec referring vpx profiles (g_profile) + // as "levels" whereas using the name "profile" for + // something else. + OMX_VIDEO_VP8LEVELTYPE mLevel; + + // Conversion buffer is needed to convert semi + // planar yuv420 to planar format + // It is only allocated if input format is + // indeed YUV420SemiPlanar. + uint8_t* mConversionBuffer; + + // Initializes input and output OMX ports with sensible + // default values. + void initPorts(); + + // Initializes vpx encoder with available settings. + status_t initEncoder(); + + // Releases vpx encoder instance, with it's associated + // data structures. + // + // Unless called earlier, this is handled by the + // dtor. + status_t releaseEncoder(); + + // Handles port changes with respect to color formats + OMX_ERRORTYPE internalSetFormatParams( + const OMX_VIDEO_PARAM_PORTFORMATTYPE* format); + + // Verifies the component role tried to be set to this OMX component is + // strictly video_encoder.vpx + OMX_ERRORTYPE internalSetRoleParams( + const OMX_PARAM_COMPONENTROLETYPE* role); + + // Updates bitrate to reflect port settings. + OMX_ERRORTYPE internalSetBitrateParams( + const OMX_VIDEO_PARAM_BITRATETYPE* bitrate); + + // Handles port definition changes. + OMX_ERRORTYPE internalSetPortParams( + const OMX_PARAM_PORTDEFINITIONTYPE* port); + + // Handles vp8 specific parameters. + OMX_ERRORTYPE internalSetVp8Params( + const OMX_VIDEO_PARAM_VP8TYPE* vp8Params); + + // Updates encoder profile + OMX_ERRORTYPE internalSetProfileLevel( + const OMX_VIDEO_PARAM_PROFILELEVELTYPE* profileAndLevel); + + DISALLOW_EVIL_CONSTRUCTORS(SoftVPXEncoder); +}; + +} // namespace android + +#endif // SOFT_VPX_ENCODER_H_ -- cgit v1.1 From 94705aff3c9eef58cbb72ec6fe5d2dcfd9481646 Mon Sep 17 00:00:00 2001 From: hkuang Date: Mon, 24 Jun 2013 11:21:17 -0700 Subject: Adds VP9 decoding support for stagefright. Also change the VP8 encoder role name from video_encoder.vpx to video_encoder.vp8 for future VP9 encoder support. Requires the change in frameworks/native and media_codecs.xml corresponding to the device. VP9 decoding test will be added to cts repo later. --- media/libstagefright/codecs/on2/enc/SoftVPXEncoder.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'media/libstagefright/codecs/on2/enc/SoftVPXEncoder.h') diff --git a/media/libstagefright/codecs/on2/enc/SoftVPXEncoder.h b/media/libstagefright/codecs/on2/enc/SoftVPXEncoder.h index 3bc05c0..a0a8ee6 100644 --- a/media/libstagefright/codecs/on2/enc/SoftVPXEncoder.h +++ b/media/libstagefright/codecs/on2/enc/SoftVPXEncoder.h @@ -175,7 +175,7 @@ class SoftVPXEncoder : public SimpleSoftOMXComponent { const OMX_VIDEO_PARAM_PORTFORMATTYPE* format); // Verifies the component role tried to be set to this OMX component is - // strictly video_encoder.vpx + // strictly video_encoder.vp8 OMX_ERRORTYPE internalSetRoleParams( const OMX_PARAM_COMPONENTROLETYPE* role); -- cgit v1.1 From a0a63e13788a77bc502da0c72269d82c4779ac91 Mon Sep 17 00:00:00 2001 From: Andreas Huber Date: Wed, 17 Jul 2013 14:02:31 -0700 Subject: Experimental support for enabling the use of "surface input" mode even with the software VP8 encoder. This relies heavily on the fact that the "Nexus" devices use ARGB32 as the colorspace for the data underlying a surface provided by SurfaceFlinger (mirroring). Generally there are no such guarantees. Change-Id: I1de32f591a3bb935ca76151816b3a02665bec40b --- media/libstagefright/codecs/on2/enc/SoftVPXEncoder.h | 15 +++++++++++---- 1 file changed, 11 insertions(+), 4 deletions(-) (limited to 'media/libstagefright/codecs/on2/enc/SoftVPXEncoder.h') diff --git a/media/libstagefright/codecs/on2/enc/SoftVPXEncoder.h b/media/libstagefright/codecs/on2/enc/SoftVPXEncoder.h index a0a8ee6..d570154 100644 --- a/media/libstagefright/codecs/on2/enc/SoftVPXEncoder.h +++ b/media/libstagefright/codecs/on2/enc/SoftVPXEncoder.h @@ -23,6 +23,8 @@ #include #include +#include + #include "vpx/vpx_encoder.h" #include "vpx/vpx_codec.h" #include "vpx/vp8cx.h" @@ -57,14 +59,13 @@ namespace android { // - OMX timestamps are in microseconds, therefore // encoder timebase is fixed to 1/1000000 -class SoftVPXEncoder : public SimpleSoftOMXComponent { - public: +struct SoftVPXEncoder : public SimpleSoftOMXComponent { SoftVPXEncoder(const char *name, const OMX_CALLBACKTYPE *callbacks, OMX_PTR appData, OMX_COMPONENTTYPE **component); - protected: +protected: virtual ~SoftVPXEncoder(); // Returns current values for requested OMX @@ -83,7 +84,10 @@ class SoftVPXEncoder : public SimpleSoftOMXComponent { // encoding of the frame virtual void onQueueFilled(OMX_U32 portIndex); - private: + virtual OMX_ERRORTYPE getExtensionIndex( + const char *name, OMX_INDEXTYPE *index); + +private: // number of buffers allocated per port static const uint32_t kNumBuffers = 4; @@ -156,6 +160,9 @@ class SoftVPXEncoder : public SimpleSoftOMXComponent { // indeed YUV420SemiPlanar. uint8_t* mConversionBuffer; + bool mInputDataIsMeta; + const hw_module_t *mGrallocModule; + // Initializes input and output OMX ports with sensible // default values. void initPorts(); -- cgit v1.1 From 336da16a12423c496efba6ca9813d5d42a1f70f6 Mon Sep 17 00:00:00 2001 From: Andreas Huber Date: Fri, 19 Jul 2013 11:00:43 -0700 Subject: Enable support for explicitly requesting an encoded keyframe from the vp8 encoder. Change-Id: I370d5831f7d6037faf361a92521390f19f179cbe --- media/libstagefright/codecs/on2/enc/SoftVPXEncoder.h | 5 +++++ 1 file changed, 5 insertions(+) (limited to 'media/libstagefright/codecs/on2/enc/SoftVPXEncoder.h') diff --git a/media/libstagefright/codecs/on2/enc/SoftVPXEncoder.h b/media/libstagefright/codecs/on2/enc/SoftVPXEncoder.h index d570154..4ee5e51 100644 --- a/media/libstagefright/codecs/on2/enc/SoftVPXEncoder.h +++ b/media/libstagefright/codecs/on2/enc/SoftVPXEncoder.h @@ -78,6 +78,9 @@ protected: virtual OMX_ERRORTYPE internalSetParameter( OMX_INDEXTYPE index, const OMX_PTR param); + virtual OMX_ERRORTYPE setConfig( + OMX_INDEXTYPE index, const OMX_PTR params); + // OMX callback when buffers available // Note that both an input and output buffer // is expected to be available to carry out @@ -163,6 +166,8 @@ private: bool mInputDataIsMeta; const hw_module_t *mGrallocModule; + bool mKeyFrameRequested; + // Initializes input and output OMX ports with sensible // default values. void initPorts(); -- cgit v1.1 From 30c08634416a99a0f627e4de3a5f49dcf0a72fd3 Mon Sep 17 00:00:00 2001 From: Johann Date: Fri, 27 Sep 2013 17:42:12 -0700 Subject: Change VP8 encoder bitrate Allow the bitrate to be updated while the encoder is running. Bug: 8422347 Change-Id: I8427fe20921b00f92b8f99fe21691709fab354b0 --- media/libstagefright/codecs/on2/enc/SoftVPXEncoder.h | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) (limited to 'media/libstagefright/codecs/on2/enc/SoftVPXEncoder.h') diff --git a/media/libstagefright/codecs/on2/enc/SoftVPXEncoder.h b/media/libstagefright/codecs/on2/enc/SoftVPXEncoder.h index 4ee5e51..076830f 100644 --- a/media/libstagefright/codecs/on2/enc/SoftVPXEncoder.h +++ b/media/libstagefright/codecs/on2/enc/SoftVPXEncoder.h @@ -128,7 +128,10 @@ private: int32_t mHeight; // Target bitrate set for the encoder, in bits per second. - int32_t mBitrate; + uint32_t mBitrate; + + // If a request for a change it bitrate has been received. + bool mBitrateUpdated; // Bitrate control mode, either constant or variable vpx_rc_mode mBitrateControlMode; -- cgit v1.1