void /* PRIVATE */ png_push_handle_iTXt(png_structp png_ptr, png_infop info_ptr, png_uint_32 length) { if (!(png_ptr->mode & PNG_HAVE_IHDR) || (png_ptr->mode & PNG_HAVE_IEND)) { PNG_UNUSED(info_ptr) /* To quiet some compiler warnings */ png_error(png_ptr, "Out of place iTXt"); /*NOT REACHED*/ } #ifdef PNG_MAX_MALLOC_64K png_ptr->skip_length = 0; /* This may not be necessary */ if (length > (png_uint_32)65535L) /* Can't hold entire string in memory */ { png_warning(png_ptr, "iTXt chunk too large to fit in memory"); png_ptr->skip_length = length - (png_uint_32)65535L; length = (png_uint_32)65535L; } #endif png_ptr->current_text = (png_charp)png_malloc(png_ptr, (png_size_t)(length + 1)); png_ptr->current_text[length] = '\0'; png_ptr->current_text_ptr = png_ptr->current_text; png_ptr->current_text_size = (png_size_t)length; png_ptr->current_text_left = (png_size_t)length; png_ptr->process_mode = PNG_READ_iTXt_MODE; }
void /* PRIVATE */ png_push_handle_zTXt(png_structp png_ptr, png_infop info_ptr, png_uint_32 length) { if (!(png_ptr->mode & PNG_HAVE_IHDR) || (png_ptr->mode & PNG_HAVE_IEND)) { PNG_UNUSED(info_ptr) /* To quiet some compiler warnings */ png_error(png_ptr, "Out of place zTXt"); /*NOT REACHED*/ } #ifdef PNG_MAX_MALLOC_64K /* We can't handle zTXt chunks > 64K, since we don't have enough space * to be able to store the uncompressed data. Actually, the threshold * is probably around 32K, but it isn't as definite as 64K is. */ if (length > (png_uint_32)65535L) { png_warning(png_ptr, "zTXt chunk too large to fit in memory"); png_push_crc_skip(png_ptr, length); return; } #endif png_ptr->current_text = (png_charp)png_malloc(png_ptr, (png_size_t)(length + 1)); png_ptr->current_text[length] = '\0'; png_ptr->current_text_ptr = png_ptr->current_text; png_ptr->current_text_size = (png_size_t)length; png_ptr->current_text_left = (png_size_t)length; png_ptr->process_mode = PNG_READ_zTXt_MODE; }
void png_read_filter_row_sub3_sse(png_row_infop row_info, png_bytep row, png_const_bytep prev_row) { png_size_t i; png_bytep rp = row; __m128i racc = _mm_setzero_si128(); PNG_UNUSED(prev_row) __m128i nrb = _mm_load_si128((__m128i*)(rp)); for (i = 0; i < row_info->rowbytes; i += 15, rp += 15) { __m128i rb = nrb; #ifndef __SSSE3__ nrb = _mm_loadu_si128((__m128i*)(rp + 15)); racc = _mm_srli_si128(_mm_slli_si128(racc, 1), 13); racc = _mm_or_si128(racc, _mm_slli_si128(rb, 3)); #else nrb = _mm_lddqu_si128((__m128i*)(rp + 15)); racc = _mm_alignr_epi8(rb, _mm_slli_si128(racc, 1), 13); #endif rb = _mm_add_epi8(rb, racc); racc = _mm_slli_si128(racc, 3); rb = _mm_add_epi8(rb, racc); racc = _mm_slli_si128(racc, 3); rb = _mm_add_epi8(rb, racc); racc = _mm_slli_si128(racc, 3); rb = _mm_add_epi8(rb, racc); racc = _mm_slli_si128(racc, 3); rb = _mm_add_epi8(rb, racc); racc = rb; _mm_storeu_si128((__m128i*)rp, rb); } }