/* Thirdparty code presumably from http://wss.co.uk/pinknoise/yuv2rgb/ */ /* This YUV2RGB code is Copyright (C) 2008-11 Robin Watts <[email protected]>. The software is released under the BSD license. THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. In particular, I warrant absolutely nothing about how patent free this method is. It is your responsibility to ensure that this code does not infringe any patents that apply in your area before you ship it. */ /* * Please note that this version has been modified for various reasons: * 1. Using the Godot core typedefs * 2. At some point or another the code relied on the byte order of a uint32_t, this has been fixed * 3. Output has been reordered to struct { uint8_t r, g, b, a; } precisely in accordance with the function names * 4. Removing unused 'dither' parameter */ #ifndef YUV2RGB_H #define YUV2RGB_H #include "core/typedefs.h" static const uint32_t tables[256*3] = …; /* -- Common -- */ #define FLAGS … #define READUV … #define READY … #define FIXUP … #define STORE … /* -- End Common -- */ static void yuv422_2_rgb8888(uint8_t *dst_ptr, const uint8_t *y_ptr, const uint8_t *u_ptr, const uint8_t *v_ptr, int32_t width, int32_t height, int32_t y_span, int32_t uv_span, int32_t dst_span) { … } static void yuv420_2_rgb8888(uint8_t *dst_ptr, const uint8_t *y_ptr, const uint8_t *u_ptr, const uint8_t *v_ptr, int32_t width, int32_t height, int32_t y_span, int32_t uv_span, int32_t dst_span) { … } static void yuv444_2_rgb8888(uint8_t *dst_ptr, const uint8_t *y_ptr, const uint8_t *u_ptr, const uint8_t *v_ptr, int32_t width, int32_t height, int32_t y_span, int32_t uv_span, int32_t dst_span) { … } #undef FLAGS #undef READUV #undef READY #undef FIXUP #undef STORE #endif // YUV2RGB_H