RELAND C2Soft Enc: Use correct matrix and range in RGB to YUV conversion

Update avc, hevc, vp8 and vp9 encoders to pick correct conversion matrix
and range during YUV to RGB conversion.

Test: atest android.mediav2.cts.EncodeDecodeAccuracyTest
Bug: 234641213
Bug: 170747332
Change-Id: Idb83c6e6e416665405fbe498dce8d56a3cdf857c
(cherry picked from commit 8764723e8e327e32e66624b6a1bcb3f2e3847de8)
Merged-In: Idb83c6e6e416665405fbe498dce8d56a3cdf857c
diff --git a/media/codec2/components/vpx/C2SoftVpxEnc.cpp b/media/codec2/components/vpx/C2SoftVpxEnc.cpp
index 617769b..f99ee24 100644
--- a/media/codec2/components/vpx/C2SoftVpxEnc.cpp
+++ b/media/codec2/components/vpx/C2SoftVpxEnc.cpp
@@ -733,8 +733,14 @@
     switch (layout.type) {
         case C2PlanarLayout::TYPE_RGB:
         case C2PlanarLayout::TYPE_RGBA: {
+            std::shared_ptr<C2StreamColorAspectsInfo::output> colorAspects;
+            {
+                IntfImpl::Lock lock = mIntf->lock();
+                colorAspects = mIntf->getCodedColorAspects_l();
+            }
             ConvertRGBToPlanarYUV(mConversionBuffer.data(), stride, vstride,
-                                  mConversionBuffer.size(), *rView.get());
+                                  mConversionBuffer.size(), *rView.get(),
+                                  colorAspects->matrix, colorAspects->range);
             vpx_img_wrap(&raw_frame, VPX_IMG_FMT_I420, width, height,
                          mStrideAlign, mConversionBuffer.data());
             break;