gav1: support 444 and 422 for 10bit (YV12/P010 paths)

This will enable 444 and 422 support for AVIF images as well.
The HAL_PIXEL_FORMAT_RGBA_1010102 path is left as a follow up.

I?10ToP010 were added in:
  7ed0473 Update external/libyuv to r1837
and upstream in version 1779.

To keep this compatible with mainline LIBYUV_VERSION checks are added
around the new code. libyuv is not a part of mainline and is currently
at libyuv version 1732.

Bug: 261112792
Bug: 279553165
Test: decode images on oriole and panther devices
Test: compile pre/post libyuv update
(cherry picked from https://googleplex-android-review.googlesource.com/q/commit:d0466e830e09a8e7912fcad94b771b1607755f2a)
Merged-In: I2593552a5cb9c343f7939d32803ed61e3e8f47e3
Change-Id: I2593552a5cb9c343f7939d32803ed61e3e8f47e3
diff --git a/media/codec2/components/gav1/C2SoftGav1Dec.h b/media/codec2/components/gav1/C2SoftGav1Dec.h
index f0e14d7..c3b27ea 100644
--- a/media/codec2/components/gav1/C2SoftGav1Dec.h
+++ b/media/codec2/components/gav1/C2SoftGav1Dec.h
@@ -19,6 +19,8 @@
 
 #include <inttypes.h>
 
+#include <memory>
+
 #include <media/stagefright/foundation/ColorUtils.h>
 
 #include <SimpleC2Component.h>
@@ -60,6 +62,9 @@
   uint32_t mHeight;
   bool mSignalledOutputEos;
   bool mSignalledError;
+  // Used during 10-bit I444/I422 to 10-bit P010 & 8-bit I420 conversions.
+  std::unique_ptr<uint16_t[]> mTmpFrameBuffer;
+  size_t mTmpFrameBufferSize = 0;
 
   C2StreamHdrStaticMetadataInfo::output mHdrStaticMetadataInfo;
   std::unique_ptr<C2StreamHdr10PlusInfo::output> mHdr10PlusInfo = nullptr;
@@ -97,6 +102,9 @@
   void destroyDecoder();
   void finishWork(uint64_t index, const std::unique_ptr<C2Work>& work,
                   const std::shared_ptr<C2GraphicBlock>& block);
+  // Sets |work->result| and mSignalledError. Returns false.
+  void setError(const std::unique_ptr<C2Work> &work, c2_status_t error);
+  bool allocTmpFrameBuffer(size_t size);
   bool outputBuffer(const std::shared_ptr<C2BlockPool>& pool,
                     const std::unique_ptr<C2Work>& work);
   c2_status_t drainInternal(uint32_t drainMode,