/* * Copyright (c) 2012 The WebM project authors. All Rights Reserved. * * Use of this source code is governed by a BSD-style license * that can be found in the LICENSE file in the root of the source * tree. An additional intellectual property rights grant can be found * in the file PATENTS. All contributing project authors may * be found in the AUTHORS file in the root of the source tree.
*/
/* In C x is compared to zbin where zbin = zbin[] + boost + extra. Rebalance * the equation because boost is the only value which can change:
* x - (zbin[] + extra) >= boost */
x_minus_zbin0 = _mm_sub_epi16(x0, zbin0);
x_minus_zbin1 = _mm_sub_epi16(x1, zbin1);
/* All the remaining calculations are valid whether they are done now with
* simd or later inside the loop one at a time. */
x0 = _mm_add_epi16(x0, round0);
x1 = _mm_add_epi16(x1, round1);
/* Instead of shifting each value independently we convert the scaling
* factor with 1 << (16 - shift) so we can use multiply/return high half. */
y0 = _mm_mulhi_epi16(y0, quant_shift0);
y1 = _mm_mulhi_epi16(y1, quant_shift1);
/* The first part of the zig zag needs a value
* from x_minus_zbin1 and vice versa. */
t1 = _mm_alignr_epi8(x_minus_zbin1, x_minus_zbin1, 2);
t0 = _mm_blend_epi16(x_minus_zbin0, t1, 0x80);
t1 = _mm_blend_epi16(t1, x_minus_zbin0, 0x80);
x_shuf0 = _mm_shuffle_epi8(t0, zig_zag_i16_0);
x_shuf1 = _mm_shuffle_epi8(t1, zig_zag_i16_1);
}
/* Check if y is nonzero and put it in zig zag order. */
t0 = _mm_packs_epi16(y0, y1);
t0 = _mm_cmpeq_epi8(t0, _mm_setzero_si128());
t0 = _mm_shuffle_epi8(t0, _mm_load_si128((const __m128i *)zig_zag_mask));
ymask = _mm_movemask_epi8(t0) ^ 0xffff;
for (;;) {
t0 = _mm_cmpgt_epi16(zbin_boost0, x_shuf0);
t1 = _mm_cmpgt_epi16(zbin_boost1, x_shuf1);
t0 = _mm_packs_epi16(t0, t1);
mask = _mm_movemask_epi8(t0);
mask = ~mask & ymask; if (!mask) break; /* |eob| will contain the index of the next found element where:
* boost[i - old_eob - 1] <= x[zigzag[i]] && y[zigzag[i]] != 0 */
eob = get_lsb(mask); /* Need to clear the mask from processed elements so that
* they are no longer counted in the next iteration. */
ymask &= ~1U << eob; /* It's safe to read ahead of this buffer if struct VP8_COMP has at * least 32 bytes before the zrun_zbin_boost_* fields (it has 384).
* Any data read outside of the buffer is masked by the updated |ymask|. */
zbin_boost0 = _mm_loadu_si128((__m128i *)(zbin_boost_ptr - eob - 1));
zbin_boost1 = _mm_loadu_si128((__m128i *)(zbin_boost_ptr - eob + 7));
qcoeff[zig_zag_mask[eob]] = 0xffff;
}
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.