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

Commit 6c5b27ac authored by Ray Essick's avatar Ray Essick Committed by Presubmit Automerger Backend
Browse files

[automerge] AV1 and HEVC SW codecs min input buffer size 2p: 1af2cc5a

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

Bug: 215297028
Change-Id: Ie7cf7ac008b5e7996ffe9915223cec4b7ea02920
parents cfbaa7e2 1af2cc5a
Loading
Loading
Loading
Loading
+6 −5
Original line number Original line Diff line number Diff line
@@ -32,6 +32,8 @@ namespace android {
// 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;


constexpr size_t kMinInputBufferSize = 2 * 1024 * 1024;

class C2SoftGav1Dec::IntfImpl : public SimpleInterface<void>::BaseParams {
class C2SoftGav1Dec::IntfImpl : public SimpleInterface<void>::BaseParams {
 public:
 public:
  explicit IntfImpl(const std::shared_ptr<C2ReflectorHelper> &helper)
  explicit IntfImpl(const std::shared_ptr<C2ReflectorHelper> &helper)
@@ -110,8 +112,7 @@ class C2SoftGav1Dec::IntfImpl : public SimpleInterface<void>::BaseParams {
            .build());
            .build());


    addParameter(DefineParam(mMaxInputSize, C2_PARAMKEY_INPUT_MAX_BUFFER_SIZE)
    addParameter(DefineParam(mMaxInputSize, C2_PARAMKEY_INPUT_MAX_BUFFER_SIZE)
                     .withDefault(new C2StreamMaxBufferSizeInfo::input(
                     .withDefault(new C2StreamMaxBufferSizeInfo::input(0u, kMinInputBufferSize))
                         0u, 320 * 240 * 3 / 4))
                     .withFields({
                     .withFields({
                         C2F(mMaxInputSize, value).any(),
                         C2F(mMaxInputSize, value).any(),
                     })
                     })
@@ -227,9 +228,9 @@ class C2SoftGav1Dec::IntfImpl : public SimpleInterface<void>::BaseParams {
      bool mayBlock, C2P<C2StreamMaxBufferSizeInfo::input> &me,
      bool mayBlock, C2P<C2StreamMaxBufferSizeInfo::input> &me,
      const C2P<C2StreamMaxPictureSizeTuning::output> &maxSize) {
      const C2P<C2StreamMaxPictureSizeTuning::output> &maxSize) {
    (void)mayBlock;
    (void)mayBlock;
    // assume compression ratio of 2
    // assume compression ratio of 2, but enforce a floor
    me.set().value =
    me.set().value = c2_max((((maxSize.v.width + 63) / 64)
        (((maxSize.v.width + 63) / 64) * ((maxSize.v.height + 63) / 64) * 3072);
                * ((maxSize.v.height + 63) / 64) * 3072), kMinInputBufferSize);
    return C2R::Ok();
    return C2R::Ok();
  }
  }


+5 −3
Original line number Original line Diff line number Diff line
@@ -34,6 +34,7 @@ namespace {
constexpr char COMPONENT_NAME[] = "c2.android.hevc.decoder";
constexpr char COMPONENT_NAME[] = "c2.android.hevc.decoder";
constexpr uint32_t kDefaultOutputDelay = 8;
constexpr uint32_t kDefaultOutputDelay = 8;
constexpr uint32_t kMaxOutputDelay = 16;
constexpr uint32_t kMaxOutputDelay = 16;
constexpr size_t kMinInputBufferSize = 2 * 1024 * 1024;
}  // namespace
}  // namespace


class C2SoftHevcDec::IntfImpl : public SimpleInterface<void>::BaseParams {
class C2SoftHevcDec::IntfImpl : public SimpleInterface<void>::BaseParams {
@@ -108,7 +109,7 @@ public:


        addParameter(
        addParameter(
                DefineParam(mMaxInputSize, C2_PARAMKEY_INPUT_MAX_BUFFER_SIZE)
                DefineParam(mMaxInputSize, C2_PARAMKEY_INPUT_MAX_BUFFER_SIZE)
                .withDefault(new C2StreamMaxBufferSizeInfo::input(0u, 320 * 240 * 3 / 4))
                .withDefault(new C2StreamMaxBufferSizeInfo::input(0u, kMinInputBufferSize))
                .withFields({
                .withFields({
                    C2F(mMaxInputSize, value).any(),
                    C2F(mMaxInputSize, value).any(),
                })
                })
@@ -220,8 +221,9 @@ public:
    static C2R MaxInputSizeSetter(bool mayBlock, C2P<C2StreamMaxBufferSizeInfo::input> &me,
    static C2R MaxInputSizeSetter(bool mayBlock, C2P<C2StreamMaxBufferSizeInfo::input> &me,
                                  const C2P<C2StreamMaxPictureSizeTuning::output> &maxSize) {
                                  const C2P<C2StreamMaxPictureSizeTuning::output> &maxSize) {
        (void)mayBlock;
        (void)mayBlock;
        // assume compression ratio of 2
        // assume compression ratio of 2, but enforce a floor
        me.set().value = (((maxSize.v.width + 63) / 64) * ((maxSize.v.height + 63) / 64) * 3072);
        me.set().value = c2_max((((maxSize.v.width + 63) / 64)
                    * ((maxSize.v.height + 63) / 64) * 3072), kMinInputBufferSize);
        return C2R::Ok();
        return C2R::Ok();
    }
    }