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

Commit 74539817 authored by Android Build Coastguard Worker's avatar Android Build Coastguard Worker
Browse files

Snap for 7514518 from 2c5c60cf to sc-d1-release

Change-Id: I4ad81c04f09c415cfe1d31f8012203399432dce3
parents 04193eba 2c5c60cf
Loading
Loading
Loading
Loading
+1 −0
Original line number Original line Diff line number Diff line
@@ -8,4 +8,5 @@ service media.transcoding /apex/com.android.media/bin/mediatranscoding
    ioprio rt 4
    ioprio rt 4
    # Restrict to little cores only with system-background cpuset.
    # Restrict to little cores only with system-background cpuset.
    writepid /dev/cpuset/system-background/tasks
    writepid /dev/cpuset/system-background/tasks
    interface aidl media.transcoding
    disabled
    disabled
+56 −16
Original line number Original line Diff line number Diff line
@@ -26,6 +26,11 @@
#include <media/stagefright/foundation/MediaDefs.h>
#include <media/stagefright/foundation/MediaDefs.h>


namespace android {
namespace android {
namespace {

constexpr uint8_t NEUTRAL_UV_VALUE = 128;

}  // namespace


// codecname set and passed in as a compile flag from Android.bp
// codecname set and passed in as a compile flag from Android.bp
constexpr char COMPONENT_NAME[] = CODECNAME;
constexpr char COMPONENT_NAME[] = CODECNAME;
@@ -51,8 +56,8 @@ class C2SoftGav1Dec::IntfImpl : public SimpleInterface<void>::BaseParams {
        DefineParam(mSize, C2_PARAMKEY_PICTURE_SIZE)
        DefineParam(mSize, C2_PARAMKEY_PICTURE_SIZE)
            .withDefault(new C2StreamPictureSizeInfo::output(0u, 320, 240))
            .withDefault(new C2StreamPictureSizeInfo::output(0u, 320, 240))
            .withFields({
            .withFields({
                C2F(mSize, width).inRange(2, 2048, 2),
                C2F(mSize, width).inRange(2, 4096, 2),
                C2F(mSize, height).inRange(2, 2048, 2),
                C2F(mSize, height).inRange(2, 4096, 2),
            })
            })
            .withSetter(SizeSetter)
            .withSetter(SizeSetter)
            .build());
            .build());
@@ -464,7 +469,8 @@ static void copyOutputBufferToYV12Frame(uint8_t *dstY, uint8_t *dstU, uint8_t *d
                                        const uint8_t *srcY, const uint8_t *srcU, const uint8_t *srcV,
                                        const uint8_t *srcY, const uint8_t *srcU, const uint8_t *srcV,
                                        size_t srcYStride, size_t srcUStride, size_t srcVStride,
                                        size_t srcYStride, size_t srcUStride, size_t srcVStride,
                                        size_t dstYStride, size_t dstUVStride,
                                        size_t dstYStride, size_t dstUVStride,
                                        uint32_t width, uint32_t height) {
                                        uint32_t width, uint32_t height,
                                        bool isMonochrome) {


  for (size_t i = 0; i < height; ++i) {
  for (size_t i = 0; i < height; ++i) {
    memcpy(dstY, srcY, width);
    memcpy(dstY, srcY, width);
@@ -472,6 +478,17 @@ static void copyOutputBufferToYV12Frame(uint8_t *dstY, uint8_t *dstU, uint8_t *d
    dstY += dstYStride;
    dstY += dstYStride;
  }
  }


  if (isMonochrome) {
    // Fill with neutral U/V values.
    for (size_t i = 0; i < height / 2; ++i) {
      memset(dstV, NEUTRAL_UV_VALUE, width / 2);
      memset(dstU, NEUTRAL_UV_VALUE, width / 2);
      dstV += dstUVStride;
      dstU += dstUVStride;
    }
    return;
  }

  for (size_t i = 0; i < height / 2; ++i) {
  for (size_t i = 0; i < height / 2; ++i) {
    memcpy(dstV, srcV, width / 2);
    memcpy(dstV, srcV, width / 2);
    srcV += srcVStride;
    srcV += srcVStride;
@@ -557,7 +574,7 @@ static void convertYUV420Planar16ToYUV420Planar(
    const uint16_t *srcY, const uint16_t *srcU, const uint16_t *srcV,
    const uint16_t *srcY, const uint16_t *srcU, const uint16_t *srcV,
    size_t srcYStride, size_t srcUStride, size_t srcVStride,
    size_t srcYStride, size_t srcUStride, size_t srcVStride,
    size_t dstYStride, size_t dstUVStride,
    size_t dstYStride, size_t dstUVStride,
    size_t width, size_t height) {
    size_t width, size_t height, bool isMonochrome) {


  for (size_t y = 0; y < height; ++y) {
  for (size_t y = 0; y < height; ++y) {
    for (size_t x = 0; x < width; ++x) {
    for (size_t x = 0; x < width; ++x) {
@@ -568,6 +585,17 @@ static void convertYUV420Planar16ToYUV420Planar(
    dstY += dstYStride;
    dstY += dstYStride;
  }
  }


  if (isMonochrome) {
    // Fill with neutral U/V values.
    for (size_t y = 0; y < (height + 1) / 2; ++y) {
      memset(dstV, NEUTRAL_UV_VALUE, (width + 1) / 2);
      memset(dstU, NEUTRAL_UV_VALUE, (width + 1) / 2);
      dstV += dstUVStride;
      dstU += dstUVStride;
    }
    return;
  }

  for (size_t y = 0; y < (height + 1) / 2; ++y) {
  for (size_t y = 0; y < (height + 1) / 2; ++y) {
    for (size_t x = 0; x < (width + 1) / 2; ++x) {
    for (size_t x = 0; x < (width + 1) / 2; ++x) {
      dstU[x] = (uint8_t)(srcU[x] >> 2);
      dstU[x] = (uint8_t)(srcU[x] >> 2);
@@ -623,8 +651,16 @@ bool C2SoftGav1Dec::outputBuffer(const std::shared_ptr<C2BlockPool> &pool,
    }
    }
  }
  }


  // TODO(vigneshv): Add support for monochrome videos since AV1 supports it.
  if (!(buffer->image_format == libgav1::kImageFormatYuv420 ||
  CHECK(buffer->image_format == libgav1::kImageFormatYuv420);
        buffer->image_format == libgav1::kImageFormatMonochrome400)) {
    ALOGE("image_format %d not supported", buffer->image_format);
    mSignalledError = true;
    work->workletsProcessed = 1u;
    work->result = C2_CORRUPTED;
    return false;
  }
  const bool isMonochrome =
      buffer->image_format == libgav1::kImageFormatMonochrome400;


  std::shared_ptr<C2GraphicBlock> block;
  std::shared_ptr<C2GraphicBlock> block;
  uint32_t format = HAL_PIXEL_FORMAT_YV12;
  uint32_t format = HAL_PIXEL_FORMAT_YV12;
@@ -636,6 +672,13 @@ bool C2SoftGav1Dec::outputBuffer(const std::shared_ptr<C2BlockPool> &pool,
    if (defaultColorAspects->primaries == C2Color::PRIMARIES_BT2020 &&
    if (defaultColorAspects->primaries == C2Color::PRIMARIES_BT2020 &&
        defaultColorAspects->matrix == C2Color::MATRIX_BT2020 &&
        defaultColorAspects->matrix == C2Color::MATRIX_BT2020 &&
        defaultColorAspects->transfer == C2Color::TRANSFER_ST2084) {
        defaultColorAspects->transfer == C2Color::TRANSFER_ST2084) {
      if (buffer->image_format != libgav1::kImageFormatYuv420) {
        ALOGE("Only YUV420 output is supported when targeting RGBA_1010102");
        mSignalledError = true;
        work->result = C2_OMITTED;
        work->workletsProcessed = 1u;
        return false;
      }
      format = HAL_PIXEL_FORMAT_RGBA_1010102;
      format = HAL_PIXEL_FORMAT_RGBA_1010102;
    }
    }
  }
  }
@@ -682,21 +725,18 @@ bool C2SoftGav1Dec::outputBuffer(const std::shared_ptr<C2BlockPool> &pool,
          (uint32_t *)dstY, srcY, srcU, srcV, srcYStride / 2, srcUStride / 2,
          (uint32_t *)dstY, srcY, srcU, srcV, srcYStride / 2, srcUStride / 2,
          srcVStride / 2, dstYStride / sizeof(uint32_t), mWidth, mHeight);
          srcVStride / 2, dstYStride / sizeof(uint32_t), mWidth, mHeight);
    } else {
    } else {
      convertYUV420Planar16ToYUV420Planar(dstY, dstU, dstV,
      convertYUV420Planar16ToYUV420Planar(
                                          srcY, srcU, srcV,
          dstY, dstU, dstV, srcY, srcU, srcV, srcYStride / 2, srcUStride / 2,
                                          srcYStride / 2, srcUStride / 2, srcVStride / 2,
          srcVStride / 2, dstYStride, dstUVStride, mWidth, mHeight,
                                          dstYStride, dstUVStride,
          isMonochrome);
                                          mWidth, mHeight);
    }
    }
  } else {
  } else {
    const uint8_t *srcY = (const uint8_t *)buffer->plane[0];
    const uint8_t *srcY = (const uint8_t *)buffer->plane[0];
    const uint8_t *srcU = (const uint8_t *)buffer->plane[1];
    const uint8_t *srcU = (const uint8_t *)buffer->plane[1];
    const uint8_t *srcV = (const uint8_t *)buffer->plane[2];
    const uint8_t *srcV = (const uint8_t *)buffer->plane[2];
    copyOutputBufferToYV12Frame(dstY, dstU, dstV,
    copyOutputBufferToYV12Frame(
                                srcY, srcU, srcV,
        dstY, dstU, dstV, srcY, srcU, srcV, srcYStride, srcUStride, srcVStride,
                                srcYStride, srcUStride, srcVStride,
        dstYStride, dstUVStride, mWidth, mHeight, isMonochrome);
                                dstYStride, dstUVStride,
                                mWidth, mHeight);
  }
  }
  finishWork(buffer->user_private_data, work, std::move(block));
  finishWork(buffer->user_private_data, work, std::move(block));
  block = nullptr;
  block = nullptr;
+11 −9
Original line number Original line Diff line number Diff line
@@ -2392,22 +2392,24 @@ typedef C2StreamParam<C2Info, C2EasyBoolValue, kParamIndexTunnelStartRender>
        C2StreamTunnelStartRender;
        C2StreamTunnelStartRender;
constexpr char C2_PARAMKEY_TUNNEL_START_RENDER[] = "output.tunnel-start-render";
constexpr char C2_PARAMKEY_TUNNEL_START_RENDER[] = "output.tunnel-start-render";


C2ENUM(C2PlatformConfig::encoding_quality_level_t, uint32_t,
    NONE,
    S_HANDHELD,
    S_HANDHELD_PC
);

namespace android {

/**
/**
 * Encoding quality level signaling.
 * Encoding quality level signaling.
 *
 * Signal the 'minimum encoding quality' introduced in Android 12/S. It indicates
 * whether the underlying codec is expected to take extra steps to ensure quality meets the
 * appropriate minimum. A value of NONE indicates that the codec is not to apply
 * any minimum quality bar requirements. Other values indicate that the codec is to apply
 * a minimum quality bar, with the exact quality bar being decided by the parameter value.
 */
 */
typedef C2GlobalParam<C2Setting,
typedef C2GlobalParam<C2Setting,
        C2SimpleValueStruct<C2EasyEnum<C2PlatformConfig::encoding_quality_level_t>>,
        C2SimpleValueStruct<C2EasyEnum<C2PlatformConfig::encoding_quality_level_t>>,
        kParamIndexEncodingQualityLevel> C2EncodingQualityLevel;
        kParamIndexEncodingQualityLevel> C2EncodingQualityLevel;
constexpr char C2_PARAMKEY_ENCODING_QUALITY_LEVEL[] = "algo.encoding-quality-level";


}
C2ENUM(C2PlatformConfig::encoding_quality_level_t, uint32_t,
    NONE = 0,
    S_HANDHELD = 1              // corresponds to VMAF=70
);


/// @}
/// @}


+27 −2
Original line number Original line Diff line number Diff line
@@ -144,11 +144,36 @@ struct C2FrameData {
         * component for the input frame.
         * component for the input frame.
         */
         */
        FLAG_INCOMPLETE = (1 << 3),
        FLAG_INCOMPLETE = (1 << 3),
        /**
         * This frame has been corrected due to a bitstream error. This is a hint, and in most cases
         * can be ignored. This flag can be set by components on their output to signal the clients
         * that errors may be present but the frame should be used nonetheless. It can also be set
         * by clients to signal that the input frame has been corrected, but nonetheless should be
         * processed.
         */
        FLAG_CORRECTED = (1 << 4),
        /**
         * This frame is corrupt due to a bitstream error. This is similar to FLAG_CORRECTED,
         * with the exception that this is a hint that downstream components should not process this
         * frame.
         * <p>
         * If set on the input by the client, the input is likely non-processable and should be
         * handled similarly to uncorrectable bitstream error detected. For components that operat
         * on whole access units, this flag can be propagated to the output. Other components should
         * aim to detect access unit boundaries to determine if any part of the input frame can be
         * processed.
         * <p>
         * If set by the component, this signals to the client that the output is non-usable -
         * including possibly the metadata that may also be non-usable; -- however, the component
         * will try to recover on successive input frames.
         */
        FLAG_CORRUPT = (1 << 5),

        /**
        /**
         * This frame contains only codec-specific configuration data, and no actual access unit.
         * This frame contains only codec-specific configuration data, and no actual access unit.
         *
         *
         * \deprecated pass codec configuration with using the \todo codec-specific configuration
         * \deprecated pass codec configuration with using the C2InitData info parameter together
         * info together with the access unit.
         *             with the access unit.
         */
         */
        FLAG_CODEC_CONFIG  = (1u << 31),
        FLAG_CODEC_CONFIG  = (1u << 31),
    };
    };
+2 −0
Original line number Original line Diff line number Diff line
@@ -909,6 +909,8 @@ void CCodecConfig::initializeStandardParams() {
            }
            }
        }));
        }));


    add(ConfigMapper("android._encoding-quality-level", C2_PARAMKEY_ENCODING_QUALITY_LEVEL, "value")
        .limitTo(D::ENCODER & (D::CONFIG | D::PARAM)));
    add(ConfigMapper(KEY_QUALITY, C2_PARAMKEY_QUALITY, "value")
    add(ConfigMapper(KEY_QUALITY, C2_PARAMKEY_QUALITY, "value")
        .limitTo(D::ENCODER & (D::CONFIG | D::PARAM)));
        .limitTo(D::ENCODER & (D::CONFIG | D::PARAM)));
    add(ConfigMapper(KEY_FLAC_COMPRESSION_LEVEL, C2_PARAMKEY_COMPLEXITY, "value")
    add(ConfigMapper(KEY_FLAC_COMPRESSION_LEVEL, C2_PARAMKEY_COMPLEXITY, "value")
Loading