void rgbaint_t::scale_imm_and_clamp(const INT32 scale) { mul_imm(scale); sra_imm(8); max(0); min(255); }
void rgbaint_t::scale_and_clamp(const rgbaint_t& scale) { mul(scale); sra_imm(8); max(0); min(255); }
void rgbaint_t::scale_add_and_clamp(const rgbaint_t& scale, const rgbaint_t& other) { mul(scale); sra_imm(8); add(other); max(0); min(255); }
void rgbaint_t::scale2_add_and_clamp(const rgbaint_t& scale, const rgbaint_t& other, const rgbaint_t& scale2) { rgbaint_t color2(other); color2.mul(scale2); mul(scale); add(color2); sra_imm(8); max(0); min(255); }
void rgbaint_t::blend(const rgbaint_t& other, UINT8 factor) { const VECU32 shift = vec_splat_u32(-16); const VECS32 scale1 = { factor, factor, factor, factor }; const VECS32 scale2 = { 0x100 - factor, 0x100 - factor, 0x100 - factor, 0x100 - factor, }; VECU32 temp = vec_msum((VECU16)m_value, (VECU16)vec_rl(scale1, shift), vec_splat_u32(0)); temp = vec_msum((VECU16)other.m_value, (VECU16)vec_rl(scale2, shift), temp); m_value = vec_msum((VECU16)m_value, (VECU16)scale1, vec_mulo((VECU16)other.m_value, (VECU16)scale2)); m_value = vec_add(vec_sl(temp, shift), (VECU32)m_value); sra_imm(8); }
void rgbaint_t::blend(const rgbaint_t& other, UINT8 factor) { const VECU32 shift = vec_splat_u32(-16); const VECS32 scale1 = { factor, factor, factor, factor }; const VECS32 scale2 = { 0x100 - factor, 0x100 - factor, 0x100 - factor, 0x100 - factor, }; VECU32 temp = vec_msum(VECU16(m_value), VECU16(vec_rl(scale1, shift)), vec_splat_u32(0)); temp = vec_msum(VECU16(other.m_value), VECU16(vec_rl(scale2, shift)), temp); #if defined __LITTLE_ENDIAN__ m_value = VECS32(vec_msum(VECU16(m_value), VECU16(scale1), vec_mule(VECU16(other.m_value), VECU16(scale2)))); #else m_value = VECS32(vec_msum(VECU16(m_value), VECU16(scale1), vec_mulo(VECU16(other.m_value), VECU16(scale2)))); #endif m_value = VECS32(vec_add(vec_sl(temp, shift), VECU32(m_value))); sra_imm(8); }
void rgbaint_t::scale_imm_and_clamp(const INT32 scale) { mul_imm(scale); sra_imm(8); clamp_to_uint8(); }
void rgbaint_t::scale_and_clamp(const rgbaint_t& scale) { mul(scale); sra_imm(8); clamp_to_uint8(); }