1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
// libwebp v1.6.0, src/dsp/dec_sse41.c:
//
// Copyright 2015 Google Inc. All Rights Reserved.
//
// Use of this source code is governed by a BSD-style license
// that can be found in the COPYING 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.
// -----------------------------------------------------------------------------
//
// SSE4 version of some decoding functions.
//
// Author: Skal (pascal.massimino@gmail.com)
//! Translation of `src/dsp/dec_sse41.c` from libwebp v1.6.0.
//!
//! Work package: WP18 (SIMD x86 decoder).
//!
//! The SSE4.1 horizontal 16x16 predictor that `VP8DspInitSSE41` assigns to
//! `VP8PredLuma16[3]`, behind `vp8_pred_luma16` in `src/dsp/dec.rs` (ADR
//! 0008). `VP8DspInit` runs `VP8DspInitSSE41` only inside its SSE2 branch, so
//! the dispatch function selects `he16` when both `features().sse2` and
//! `features().sse4_1` hold, before the SSE2 variant.
//!
//! # Deviations from upstream
//!
//! 1. **Reads beyond the scalar footprint.** `HE16_SSE41` reads the four
//! bytes before each row (`WebPMemToInt32(dst - 4)`) where `HE16_C` reads
//! one, so the block must start at least four bytes into the buffer. The
//! decoder's work buffer always has them, as in C.
//! 2. **One length check per block** (issue #77). `HE16_SSE41` slices its
//! 16 rows, from four bytes before the first, once and indexes the rows
//! in that slice, so the per-row checks fold. A short buffer then panics
//! before the first row is written; the bytes are unchanged.
//!
//! # Excluded undefined behavior
//!
//! None.
//!
//! # Checks not applicable
//!
//! 1. **`VP8DspInitSSE41`** only assigns a pointer (ADR 0003); its assignment
//! is the selection in `vp8_pred_luma16`.
//! 2. **Differential probe.** The parity test compares the function with the C
//! translation it replaces (`tests/wp18_dec.rs`).
use x86 as arch;
use x86_64 as arch;
use ;
use cratestoreu_si128;
use crateBPS;
use cratewebp_mem_to_int32;
/// `BPS` as an index step.
const BPS_U: usize = BPS as usize;
// upstream: src/dsp/dec_sse41.c HE16_SSE41
/// horizontal
/// Entry point of [`he16_sse41`] for `vp8_pred_luma16` mode 3.
pub
// upstream: src/dsp/dec_sse41.c VP8DspInitSSE41 (no counterpart: it only assigns VP8PredLuma16[3], ADR 0003)