Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 897e8c75 authored by Treehugger Robot's avatar Treehugger Robot Committed by Automerger Merge Worker
Browse files

Merge "c2 vp9, av1: Produce 8 bit output when color format isn't set" am:...

Merge "c2 vp9, av1: Produce 8 bit output when color format isn't set" am: 621b2e0d am: 2e1bf258 am: d7c56635 am: 9f65be37

Original change: https://android-review.googlesource.com/c/platform/frameworks/av/+/2110984



Change-Id: I156df25cdd5a114c34a1edfd9a93851d76e0bd4d
Signed-off-by: default avatarAutomerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
parents 2a67e51b 9f65be37
Loading
Loading
Loading
Loading
+13 −1
Original line number Original line Diff line number Diff line
@@ -195,6 +195,11 @@ class C2SoftGav1Dec::IntfImpl : public SimpleInterface<void>::BaseParams {
    if (isHalPixelFormatSupported((AHardwareBuffer_Format)HAL_PIXEL_FORMAT_YCBCR_P010)) {
    if (isHalPixelFormatSupported((AHardwareBuffer_Format)HAL_PIXEL_FORMAT_YCBCR_P010)) {
        pixelFormats.push_back(HAL_PIXEL_FORMAT_YCBCR_P010);
        pixelFormats.push_back(HAL_PIXEL_FORMAT_YCBCR_P010);
    }
    }
    // If color format surface isn't added to supported formats, there is no way to know
    // when the color-format is configured to surface. This is necessary to be able to
    // choose 10-bit format while decoding 10-bit clips in surface mode.
    pixelFormats.push_back(HAL_PIXEL_FORMAT_IMPLEMENTATION_DEFINED);

    // TODO: support more formats?
    // TODO: support more formats?
    addParameter(
    addParameter(
            DefineParam(mPixelFormat, C2_PARAMKEY_PIXEL_FORMAT)
            DefineParam(mPixelFormat, C2_PARAMKEY_PIXEL_FORMAT)
@@ -323,6 +328,9 @@ class C2SoftGav1Dec::IntfImpl : public SimpleInterface<void>::BaseParams {
    return C2R::Ok();
    return C2R::Ok();
  }
  }


  // unsafe getters
  std::shared_ptr<C2StreamPixelFormatInfo::output> getPixelFormat_l() const { return mPixelFormat; }

 private:
 private:
  std::shared_ptr<C2StreamProfileLevelInfo::input> mProfileLevel;
  std::shared_ptr<C2StreamProfileLevelInfo::input> mProfileLevel;
  std::shared_ptr<C2StreamPictureSizeInfo::output> mSize;
  std::shared_ptr<C2StreamPictureSizeInfo::output> mSize;
@@ -411,6 +419,10 @@ bool C2SoftGav1Dec::initDecoder() {
  mSignalledError = false;
  mSignalledError = false;
  mSignalledOutputEos = false;
  mSignalledOutputEos = false;
  mHalPixelFormat = HAL_PIXEL_FORMAT_YV12;
  mHalPixelFormat = HAL_PIXEL_FORMAT_YV12;
  {
      IntfImpl::Lock lock = mIntf->lock();
      mPixelFormatInfo = mIntf->getPixelFormat_l();
  }
  mCodecCtx.reset(new libgav1::Decoder());
  mCodecCtx.reset(new libgav1::Decoder());


  if (mCodecCtx == nullptr) {
  if (mCodecCtx == nullptr) {
@@ -635,7 +647,7 @@ bool C2SoftGav1Dec::outputBuffer(const std::shared_ptr<C2BlockPool> &pool,
  std::shared_ptr<C2GraphicBlock> block;
  std::shared_ptr<C2GraphicBlock> block;
  uint32_t format = HAL_PIXEL_FORMAT_YV12;
  uint32_t format = HAL_PIXEL_FORMAT_YV12;
  std::shared_ptr<C2StreamColorAspectsInfo::output> codedColorAspects;
  std::shared_ptr<C2StreamColorAspectsInfo::output> codedColorAspects;
  if (buffer->bitdepth == 10) {
  if (buffer->bitdepth == 10 && mPixelFormatInfo->value != HAL_PIXEL_FORMAT_YCBCR_420_888) {
    IntfImpl::Lock lock = mIntf->lock();
    IntfImpl::Lock lock = mIntf->lock();
    codedColorAspects = mIntf->getColorAspects_l();
    codedColorAspects = mIntf->getColorAspects_l();
    bool allowRGBA1010102 = false;
    bool allowRGBA1010102 = false;
+4 −0
Original line number Original line Diff line number Diff line
@@ -51,6 +51,10 @@ struct C2SoftGav1Dec : public SimpleC2Component {
  std::shared_ptr<IntfImpl> mIntf;
  std::shared_ptr<IntfImpl> mIntf;
  std::unique_ptr<libgav1::Decoder> mCodecCtx;
  std::unique_ptr<libgav1::Decoder> mCodecCtx;


  // configurations used by component in process
  // (TODO: keep this in intf but make them internal only)
  std::shared_ptr<C2StreamPixelFormatInfo::output> mPixelFormatInfo;

  uint32_t mHalPixelFormat;
  uint32_t mHalPixelFormat;
  uint32_t mWidth;
  uint32_t mWidth;
  uint32_t mHeight;
  uint32_t mHeight;
+16 −1
Original line number Original line Diff line number Diff line
@@ -223,6 +223,10 @@ public:
        if (isHalPixelFormatSupported((AHardwareBuffer_Format)HAL_PIXEL_FORMAT_YCBCR_P010)) {
        if (isHalPixelFormatSupported((AHardwareBuffer_Format)HAL_PIXEL_FORMAT_YCBCR_P010)) {
            pixelFormats.push_back(HAL_PIXEL_FORMAT_YCBCR_P010);
            pixelFormats.push_back(HAL_PIXEL_FORMAT_YCBCR_P010);
        }
        }
        // If color format surface isn't added to supported formats, there is no way to know
        // when the color-format is configured to surface. This is necessary to be able to
        // choose 10-bit format while decoding 10-bit clips in surface mode
        pixelFormats.push_back(HAL_PIXEL_FORMAT_IMPLEMENTATION_DEFINED);
#endif
#endif
        addParameter(
        addParameter(
                DefineParam(mPixelFormat, C2_PARAMKEY_PIXEL_FORMAT)
                DefineParam(mPixelFormat, C2_PARAMKEY_PIXEL_FORMAT)
@@ -307,6 +311,11 @@ public:
        return C2R::Ok();
        return C2R::Ok();
    }
    }


    // unsafe getters
    std::shared_ptr<C2StreamPixelFormatInfo::output> getPixelFormat_l() const {
        return mPixelFormat;
    }

private:
private:
    std::shared_ptr<C2StreamProfileLevelInfo::input> mProfileLevel;
    std::shared_ptr<C2StreamProfileLevelInfo::input> mProfileLevel;
    std::shared_ptr<C2StreamPictureSizeInfo::output> mSize;
    std::shared_ptr<C2StreamPictureSizeInfo::output> mSize;
@@ -434,6 +443,11 @@ status_t C2SoftVpxDec::initDecoder() {
    mMode = MODE_VP8;
    mMode = MODE_VP8;
#endif
#endif
    mHalPixelFormat = HAL_PIXEL_FORMAT_YV12;
    mHalPixelFormat = HAL_PIXEL_FORMAT_YV12;
    {
        IntfImpl::Lock lock = mIntf->lock();
        mPixelFormatInfo = mIntf->getPixelFormat_l();
    }

    mWidth = 320;
    mWidth = 320;
    mHeight = 240;
    mHeight = 240;
    mFrameParallelMode = false;
    mFrameParallelMode = false;
@@ -689,7 +703,8 @@ status_t C2SoftVpxDec::outputBuffer(
    std::shared_ptr<C2GraphicBlock> block;
    std::shared_ptr<C2GraphicBlock> block;
    uint32_t format = HAL_PIXEL_FORMAT_YV12;
    uint32_t format = HAL_PIXEL_FORMAT_YV12;
    std::shared_ptr<C2StreamColorAspectsTuning::output> defaultColorAspects;
    std::shared_ptr<C2StreamColorAspectsTuning::output> defaultColorAspects;
    if (img->fmt == VPX_IMG_FMT_I42016) {
    if (img->fmt == VPX_IMG_FMT_I42016 &&
            mPixelFormatInfo->value != HAL_PIXEL_FORMAT_YCBCR_420_888) {
        IntfImpl::Lock lock = mIntf->lock();
        IntfImpl::Lock lock = mIntf->lock();
        defaultColorAspects = mIntf->getDefaultColorAspects_l();
        defaultColorAspects = mIntf->getDefaultColorAspects_l();
        bool allowRGBA1010102 = false;
        bool allowRGBA1010102 = false;
+4 −0
Original line number Original line Diff line number Diff line
@@ -63,6 +63,10 @@ struct C2SoftVpxDec : public SimpleC2Component {
        std::shared_ptr<Mutexed<ConversionQueue>> mQueue;
        std::shared_ptr<Mutexed<ConversionQueue>> mQueue;
    };
    };


    // configurations used by component in process
    // (TODO: keep this in intf but make them internal only)
    std::shared_ptr<C2StreamPixelFormatInfo::output> mPixelFormatInfo;

    std::shared_ptr<IntfImpl> mIntf;
    std::shared_ptr<IntfImpl> mIntf;
    vpx_codec_ctx_t *mCodecCtx;
    vpx_codec_ctx_t *mCodecCtx;
    bool mFrameParallelMode;  // Frame parallel is only supported by VP9 decoder.
    bool mFrameParallelMode;  // Frame parallel is only supported by VP9 decoder.