Fix YCgCo-Re error in avifPNGWrite()

diff --git a/apps/shared/avifpng.c b/apps/shared/avifpng.c
index bb18ebc..3b00618 100644
--- a/apps/shared/avifpng.c
+++ b/apps/shared/avifpng.c
@@ -426,7 +426,11 @@
         goto cleanup;
     }
     if (avif->matrixCoefficients == AVIF_MATRIX_COEFFICIENTS_YCGCO_RE) {
-        if (avif->depth != 10 || (requestedDepth && requestedDepth != 8)) {
+        if (avif->depth != 10) {
+            fprintf(stderr, "avif->depth must be 10 bits and not %u.\n", avif->depth);
+            goto cleanup;
+        }
+        if (requestedDepth && requestedDepth != 8) {
             fprintf(stderr, "Cannot request %u bits for YCgCo-Re as it only works for 8 bits.\n", requestedDepth);
             goto cleanup;
         }
diff --git a/src/reformat.c b/src/reformat.c
index a8e8441..7a24fce 100644
--- a/src/reformat.c
+++ b/src/reformat.c
@@ -336,9 +336,9 @@
 #if defined(AVIF_ENABLE_EXPERIMENTAL_YCGCO_R)
                         } else if (state.mode == AVIF_REFORMAT_MODE_YCGCO_RE || state.mode == AVIF_REFORMAT_MODE_YCGCO_RO) {
                             // Formulas from JVET-U0093.
-                            const int R = (int)avifRoundf(AVIF_CLAMP(rgbPixel[0] * rgbMaxChannelF, 0.f, rgbMaxChannelF));
-                            const int G = (int)avifRoundf(AVIF_CLAMP(rgbPixel[1] * rgbMaxChannelF, 0.f, rgbMaxChannelF));
-                            const int B = (int)avifRoundf(AVIF_CLAMP(rgbPixel[2] * rgbMaxChannelF, 0.f, rgbMaxChannelF));
+                            const int R = (int)avifRoundf(AVIF_CLAMP(rgbPixel[0] * rgbMaxChannelF, 0.0f, rgbMaxChannelF));
+                            const int G = (int)avifRoundf(AVIF_CLAMP(rgbPixel[1] * rgbMaxChannelF, 0.0f, rgbMaxChannelF));
+                            const int B = (int)avifRoundf(AVIF_CLAMP(rgbPixel[2] * rgbMaxChannelF, 0.0f, rgbMaxChannelF));
                             const int Co = R - B;
                             const int t = B + (Co >> 1);
                             const int Cg = G - t;