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

Commit 6cb4e0db authored by Ray Essick's avatar Ray Essick Committed by Android (Google) Code Review
Browse files

Merge "framework/av,C2SoftGav1Dec: update to libgav1 v0.16.0" into mainline-prod

parents b36ae378 ab483504
Loading
Loading
Loading
Loading
+0 −4
Original line number Original line Diff line number Diff line
@@ -13,8 +13,4 @@ cc_library_shared {


    srcs: ["C2SoftGav1Dec.cpp"],
    srcs: ["C2SoftGav1Dec.cpp"],
    static_libs: ["libgav1"],
    static_libs: ["libgav1"],

    include_dirs: [
        "external/libgav1/libgav1/",
    ],
}
}
+10 −14
Original line number Original line Diff line number Diff line
@@ -288,9 +288,7 @@ void C2SoftGav1Dec::onReset() {
void C2SoftGav1Dec::onRelease() { destroyDecoder(); }
void C2SoftGav1Dec::onRelease() { destroyDecoder(); }


c2_status_t C2SoftGav1Dec::onFlush_sm() {
c2_status_t C2SoftGav1Dec::onFlush_sm() {
  Libgav1StatusCode status =
  Libgav1StatusCode status = mCodecCtx->SignalEOS();
      mCodecCtx->EnqueueFrame(/*data=*/nullptr, /*size=*/0,
                              /*user_private_data=*/0);
  if (status != kLibgav1StatusOk) {
  if (status != kLibgav1StatusOk) {
    ALOGE("Failed to flush av1 decoder. status: %d.", status);
    ALOGE("Failed to flush av1 decoder. status: %d.", status);
    return C2_CORRUPTED;
    return C2_CORRUPTED;
@@ -299,7 +297,7 @@ c2_status_t C2SoftGav1Dec::onFlush_sm() {
  // Dequeue frame (if any) that was enqueued previously.
  // Dequeue frame (if any) that was enqueued previously.
  const libgav1::DecoderBuffer *buffer;
  const libgav1::DecoderBuffer *buffer;
  status = mCodecCtx->DequeueFrame(&buffer);
  status = mCodecCtx->DequeueFrame(&buffer);
  if (status != kLibgav1StatusOk) {
  if (status != kLibgav1StatusOk && status != kLibgav1StatusNothingToDequeue) {
    ALOGE("Failed to dequeue frame after flushing the av1 decoder. status: %d",
    ALOGE("Failed to dequeue frame after flushing the av1 decoder. status: %d",
          status);
          status);
    return C2_CORRUPTED;
    return C2_CORRUPTED;
@@ -433,7 +431,8 @@ void C2SoftGav1Dec::process(const std::unique_ptr<C2Work> &work,
    TIME_DIFF(mTimeEnd, mTimeStart, delay);
    TIME_DIFF(mTimeEnd, mTimeStart, delay);


    const Libgav1StatusCode status =
    const Libgav1StatusCode status =
        mCodecCtx->EnqueueFrame(bitstream, inSize, frameIndex);
        mCodecCtx->EnqueueFrame(bitstream, inSize, frameIndex,
                                /*buffer_private_data=*/nullptr);


    GETTIME(&mTimeEnd, nullptr);
    GETTIME(&mTimeEnd, nullptr);
    TIME_DIFF(mTimeStart, mTimeEnd, decodeTime);
    TIME_DIFF(mTimeStart, mTimeEnd, decodeTime);
@@ -448,9 +447,7 @@ void C2SoftGav1Dec::process(const std::unique_ptr<C2Work> &work,
    }
    }


  } else {
  } else {
    const Libgav1StatusCode status =
    const Libgav1StatusCode status = mCodecCtx->SignalEOS();
        mCodecCtx->EnqueueFrame(/*data=*/nullptr, /*size=*/0,
                                /*user_private_data=*/0);
    if (status != kLibgav1StatusOk) {
    if (status != kLibgav1StatusOk) {
      ALOGE("Failed to flush av1 decoder. status: %d.", status);
      ALOGE("Failed to flush av1 decoder. status: %d.", status);
      work->result = C2_CORRUPTED;
      work->result = C2_CORRUPTED;
@@ -606,13 +603,14 @@ bool C2SoftGav1Dec::outputBuffer(const std::shared_ptr<C2BlockPool> &pool,
  const libgav1::DecoderBuffer *buffer;
  const libgav1::DecoderBuffer *buffer;
  const Libgav1StatusCode status = mCodecCtx->DequeueFrame(&buffer);
  const Libgav1StatusCode status = mCodecCtx->DequeueFrame(&buffer);


  if (status != kLibgav1StatusOk) {
  if (status != kLibgav1StatusOk && status != kLibgav1StatusNothingToDequeue) {
    ALOGE("av1 decoder DequeueFrame failed. status: %d.", status);
    ALOGE("av1 decoder DequeueFrame failed. status: %d.", status);
    return false;
    return false;
  }
  }


  // |buffer| can be NULL if status was equal to kLibgav1StatusOk. This is not
  // |buffer| can be NULL if status was equal to kLibgav1StatusOk or
  // an error. This could mean one of two things:
  // kLibgav1StatusNothingToDequeue. This is not an error. This could mean one
  // of two things:
  //  - The EnqueueFrame() call was either a flush (called with nullptr).
  //  - The EnqueueFrame() call was either a flush (called with nullptr).
  //  - The enqueued frame did not have any displayable frames.
  //  - The enqueued frame did not have any displayable frames.
  if (!buffer) {
  if (!buffer) {
@@ -725,9 +723,7 @@ c2_status_t C2SoftGav1Dec::drainInternal(
    return C2_OMITTED;
    return C2_OMITTED;
  }
  }


  Libgav1StatusCode status =
  const Libgav1StatusCode status = mCodecCtx->SignalEOS();
      mCodecCtx->EnqueueFrame(/*data=*/nullptr, /*size=*/0,
                              /*user_private_data=*/0);
  if (status != kLibgav1StatusOk) {
  if (status != kLibgav1StatusOk) {
    ALOGE("Failed to flush av1 decoder. status: %d.", status);
    ALOGE("Failed to flush av1 decoder. status: %d.", status);
    return C2_CORRUPTED;
    return C2_CORRUPTED;
+2 −2
Original line number Original line Diff line number Diff line
@@ -18,8 +18,8 @@
#define ANDROID_C2_SOFT_GAV1_DEC_H_
#define ANDROID_C2_SOFT_GAV1_DEC_H_


#include <SimpleC2Component.h>
#include <SimpleC2Component.h>
#include "libgav1/src/decoder.h"
#include "libgav1/src/gav1/decoder.h"
#include "libgav1/src/decoder_settings.h"
#include "libgav1/src/gav1/decoder_settings.h"


#define GETTIME(a, b) gettimeofday(a, b);
#define GETTIME(a, b) gettimeofday(a, b);
#define TIME_DIFF(start, end, diff)     \
#define TIME_DIFF(start, end, diff)     \