MCPcopy Create free account
hub / github.com/Aleksoid1978/VideoRenderer / CopyFrameV210

Function CopyFrameV210

Source/Helper.cpp:709–748  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

707}
708
709void CopyFrameV210(const UINT lines, BYTE* dst, UINT dst_pitch, const BYTE* src, int src_pitch)
710{
711 const auto dst_blocks = std::div(dst_pitch, 12);
712 const auto src_blocks = std::div(src_pitch, 8);
713 UINT line_blocks;
714 bool remainder;
715 if (dst_blocks.quot <= src_blocks.quot) {
716 line_blocks = dst_blocks.quot;
717 remainder = dst_blocks.rem;
718 } else {
719 line_blocks = src_blocks.quot;
720 remainder = src_blocks.rem;
721 }
722
723 for (UINT y = 0; y < lines; ++y) {
724 uint32_t* src32 = (uint32_t*)src;
725 uint16_t* dst16 = (uint16_t*)dst;
726
727 for (UINT i = 0; i < line_blocks; i++) {
728 uint32_t s0 = *src32++;
729 uint32_t s1 = *src32++;
730
731 *dst16++ = (s0 >> 4) & 0xffc0;
732 *dst16++ = (s0 << 6) & 0xffc0;
733 *dst16++ = (s1 << 6) & 0xffc0;
734 *dst16++ = (s0 >> 14) & 0xffc0;
735 *dst16++ = (s1 >> 14) & 0xffc0;
736 *dst16++ = (s1 >> 4) & 0xffc0;
737 }
738 if (remainder) {
739 uint32_t s = *src32++;
740
741 *dst16++ = (s >> 4) & 0xffc0;
742 *dst16++ = (s << 6) & 0xffc0;
743 }
744
745 src += src_pitch;
746 dst += dst_pitch;
747 }
748}
749
750void CopyFrameY410(const UINT lines, BYTE* dst, UINT dst_pitch, const BYTE* src, int src_pitch)
751{

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected