Vitor <vitor1...@gmail.com> added the comment:

New patch that also fix RGB48{BE,LE}.

RGB8, RGB4 and MONO{WHITE,BLACK} are still broken but I think it is better to
just error out saying that full_chroma_int is not supported for these outputs
(and it is not very meaningful anyway).

________________________________________________
FFmpeg issue tracker <iss...@roundup.ffmpeg.org>
<https://roundup.ffmpeg.org/issue2113>
________________________________________________
Index: libswscale/swscale.c
===================================================================
--- libswscale/swscale.c	(revision 31758)
+++ libswscale/swscale.c	(working copy)
@@ -974,6 +974,54 @@
             }
         }
         break;
+    case PIX_FMT_RGB565:
+            YSCALE_YUV_2_RGBX_FULL_C(1<<21, 0)
+            ((uint16_t *)dest)[0] = B>>25 | ((G>>19) & (127 << 5)) |
+                ((R>>14) & (63 << 11));
+                dest+= step;
+            }
+        break;
+    case PIX_FMT_BGR565:
+            YSCALE_YUV_2_RGBX_FULL_C(1<<21, 0)
+            ((uint16_t *)dest)[0] = R>>25 | ((G>>19) & (127 << 5)) |
+                ((B>>14) & (63 << 11));
+                dest+= step;
+            }
+        break;
+    case PIX_FMT_BGR555:
+            YSCALE_YUV_2_RGBX_FULL_C(1<<21, 0)
+            ((uint16_t *)dest)[0] = R>>25 | ((G>>20) & (63 << 5)) |
+                ((B>>15) & (63 << 10));
+                dest+= 2;
+            }
+        break;
+    case PIX_FMT_RGB555:
+            YSCALE_YUV_2_RGBX_FULL_C(1<<21, 0)
+            ((uint16_t *)dest)[0] = B>>25 | ((G>>20) & (63 << 5)) |
+                ((R>>15) & (63 << 10));
+                dest+= 2;
+            }
+        break;
+    case PIX_FMT_RGB48:
+            YSCALE_YUV_2_RGBX_FULL_C(1<<21, 0)
+            ((uint16_t *)dest)[0] = R>>14;
+            ((uint16_t *)dest)[1] = G>>14;
+            ((uint16_t *)dest)[2] = B>>14;
+            dest+= step;
+            }
+        break;
+#if HAVE_BIGENDIAN
+    case PIX_FMT_RGB48LE:
+#else
+    case PIX_FMT_RGB48BE:
+#endif
+            YSCALE_YUV_2_RGBX_FULL_C(1<<21, 0)
+            ((uint16_t *)dest)[0] = av_bswap16(R>>14);
+            ((uint16_t *)dest)[1] = av_bswap16(G>>14);
+            ((uint16_t *)dest)[2] = av_bswap16(B>>14);
+            dest+= step;
+            }
+        break;
     default:
         assert(0);
     }

Reply via email to