#ifdefined(_MSC_VER) && !defined(__clang__) && defined(_M_ARM64) # include <arm64_neon.h> #else # include <arm_neon.h> #endif
/* Build an RGBA8 palette from the separate RGB and alpha palettes. */ void
png_riffle_palette_neon(png_structrp png_ptr)
{
png_const_colorp palette = png_ptr->palette;
png_bytep riffled_palette = png_ptr->riffled_palette;
png_const_bytep trans_alpha = png_ptr->trans_alpha; int num_trans = png_ptr->num_trans; int i;
/* First, riffle the RGB colours into an RGBA8 palette. *Thealphacomponentissettoopaquefornow.
*/ for (i = 0; i < 256; i += 16)
{
uint8x16x3_t v = vld3q_u8((png_const_bytep)(palette + i));
w.val[0] = v.val[0];
w.val[1] = v.val[1];
w.val[2] = v.val[2];
vst4q_u8(riffled_palette + i * 4, w);
}
/* Fix up the missing transparency values. */ for (i = 0; i < num_trans; i++)
riffled_palette[i * 4 + 3] = trans_alpha[i];
}
png_debug(1, "in png_do_expand_palette_rgba8_neon");
PNG_UNUSED(row) if (row_width < pixels_per_chunk) return0;
/* This function originally gets the last byte of the output row. *TheNEONpartwritesforwardfromagivenposition,sowehave *toseekthisbackby4pixelsx4bytes.
*/
*ddp = *ddp - (pixels_per_chunk * 4 - 1);
for (i = 0; i + pixels_per_chunk <= row_width; i += pixels_per_chunk)
{
uint32x4_t cur;
png_bytep sp = *ssp - i, dp = *ddp - i * 4;
cur = vld1q_dup_u32 (riffled_palette + *(sp - 3));
cur = vld1q_lane_u32(riffled_palette + *(sp - 2), cur, 1);
cur = vld1q_lane_u32(riffled_palette + *(sp - 1), cur, 2);
cur = vld1q_lane_u32(riffled_palette + *(sp - 0), cur, 3);
vst1q_u32((void *)dp, cur);
}
/* Undo the pre-adjustment of *ddp before the pointer handoff, *sothescalarfallbackinpngrtran.creceivesadpthatpoints *tothecorrectposition.
*/
*ddp = *ddp + (pixels_per_chunk * 4 - 1);
*ssp = *ssp - i;
*ddp = *ddp - i * 4; return i;
}
Die Informationen auf dieser Webseite wurden
nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit,
noch Qualität der bereit gestellten Informationen zugesichert.
Bemerkung:
Die farbliche Syntaxdarstellung und die Messung sind noch experimentell.