mirror of
https://chromium.googlesource.com/libyuv/libyuv
synced 2025-12-06 08:46:47 +08:00
Update to r1732 for more robust jpeg
Includes a rounding change for neon. BUG=b/135532289 Change-Id: I36ffb57b55db6c64804ad169def865be1ac6d66e Reviewed-on: https://chromium-review.googlesource.com/c/libyuv/libyuv/+/1684439 Commit-Queue: Frank Barchard <fbarchard@chromium.org> Reviewed-by: Chong Zhang <chz@google.com>
This commit is contained in:
parent
af9bc4f67c
commit
09cfb2bbd6
1
.gitignore
vendored
1
.gitignore
vendored
@ -12,6 +12,7 @@ pin-log.txt
|
||||
/native_client
|
||||
/net
|
||||
/out
|
||||
/source/out
|
||||
/sde-avx-sse-transition-out.txt
|
||||
/testing
|
||||
/third_party
|
||||
|
||||
@ -1,6 +1,6 @@
|
||||
Name: libyuv
|
||||
URL: http://code.google.com/p/libyuv/
|
||||
Version: 1731
|
||||
Version: 1732
|
||||
License: BSD
|
||||
License File: LICENSE
|
||||
|
||||
|
||||
@ -11,6 +11,6 @@
|
||||
#ifndef INCLUDE_LIBYUV_VERSION_H_
|
||||
#define INCLUDE_LIBYUV_VERSION_H_
|
||||
|
||||
#define LIBYUV_VERSION 1731
|
||||
#define LIBYUV_VERSION 1732
|
||||
|
||||
#endif // INCLUDE_LIBYUV_VERSION_H_
|
||||
|
||||
@ -25,7 +25,8 @@
|
||||
#endif
|
||||
|
||||
#endif
|
||||
struct FILE; // For jpeglib.h.
|
||||
|
||||
#include <stdio.h> // For jpeglib.h.
|
||||
|
||||
// C++ build requires extern C for jpeg internals.
|
||||
#ifdef __cplusplus
|
||||
@ -427,7 +428,15 @@ boolean fill_input_buffer(j_decompress_ptr cinfo) {
|
||||
}
|
||||
|
||||
void skip_input_data(j_decompress_ptr cinfo, long num_bytes) { // NOLINT
|
||||
cinfo->src->next_input_byte += num_bytes;
|
||||
jpeg_source_mgr* src = cinfo->src;
|
||||
size_t bytes = static_cast<size_t>(num_bytes);
|
||||
if(bytes > src->bytes_in_buffer) {
|
||||
src->next_input_byte = nullptr;
|
||||
src->bytes_in_buffer = 0;
|
||||
} else {
|
||||
src->next_input_byte += bytes;
|
||||
src->bytes_in_buffer -= bytes;
|
||||
}
|
||||
}
|
||||
|
||||
void term_source(j_decompress_ptr cinfo) {
|
||||
|
||||
@ -47,7 +47,8 @@ LIBYUV_BOOL ValidateJpeg(const uint8_t* src_mjpg, size_t src_size_mjpg) {
|
||||
// ERROR: Invalid jpeg size: src_size_mjpg
|
||||
return LIBYUV_FALSE;
|
||||
}
|
||||
if (src_mjpg[0] != 0xff || src_mjpg[1] != 0xd8) { // SOI marker
|
||||
// SOI marker
|
||||
if (src_mjpg[0] != 0xff || src_mjpg[1] != 0xd8 || src_mjpg[2] != 0xff) {
|
||||
// ERROR: Invalid jpeg initial start code
|
||||
return LIBYUV_FALSE;
|
||||
}
|
||||
|
||||
@ -2986,8 +2986,8 @@ void FloatDivToByteRow_NEON(const float* src_weights,
|
||||
"fdiv v1.4s, v3.4s, v1.4s \n" // values / weights
|
||||
"fdiv v2.4s, v4.4s, v2.4s \n"
|
||||
|
||||
"fcvtzu v1.4s, v1.4s \n" // float to int
|
||||
"fcvtzu v2.4s, v2.4s \n" // float to int
|
||||
"fcvtas v1.4s, v1.4s \n" // float to int
|
||||
"fcvtas v2.4s, v2.4s \n" // float to int
|
||||
"uqxtn v1.4h, v1.4s \n" // 8 shorts
|
||||
"uqxtn2 v1.8h, v2.4s \n"
|
||||
"uqxtn v1.8b, v1.8h \n" // 8 bytes
|
||||
|
||||
@ -1390,6 +1390,7 @@ TEST_F(LibYUVConvertTest, ValidateJpeg) {
|
||||
// EOI, SOI. Expect pass.
|
||||
orig_pixels[0] = 0xff;
|
||||
orig_pixels[1] = 0xd8; // SOI.
|
||||
orig_pixels[2] = 0xff;
|
||||
orig_pixels[kSize - kOff + 0] = 0xff;
|
||||
orig_pixels[kSize - kOff + 1] = 0xd9; // EOI.
|
||||
for (int times = 0; times < benchmark_iterations_; ++times) {
|
||||
@ -1416,6 +1417,7 @@ TEST_F(LibYUVConvertTest, ValidateJpegLarge) {
|
||||
// EOI, SOI. Expect pass.
|
||||
orig_pixels[0] = 0xff;
|
||||
orig_pixels[1] = 0xd8; // SOI.
|
||||
orig_pixels[2] = 0xff;
|
||||
orig_pixels[kSize - kOff + 0] = 0xff;
|
||||
orig_pixels[kSize - kOff + 1] = 0xd9; // EOI.
|
||||
for (int times = 0; times < benchmark_iterations_; ++times) {
|
||||
@ -1449,6 +1451,7 @@ TEST_F(LibYUVConvertTest, InvalidateJpeg) {
|
||||
// SOI but no EOI. Expect fail.
|
||||
orig_pixels[0] = 0xff;
|
||||
orig_pixels[1] = 0xd8; // SOI.
|
||||
orig_pixels[2] = 0xff;
|
||||
for (int times = 0; times < benchmark_iterations_; ++times) {
|
||||
EXPECT_FALSE(ValidateJpeg(orig_pixels, kSize));
|
||||
}
|
||||
@ -1466,13 +1469,14 @@ TEST_F(LibYUVConvertTest, InvalidateJpeg) {
|
||||
TEST_F(LibYUVConvertTest, FuzzJpeg) {
|
||||
// SOI but no EOI. Expect fail.
|
||||
for (int times = 0; times < benchmark_iterations_; ++times) {
|
||||
const int kSize = fastrand() % 5000 + 2;
|
||||
const int kSize = fastrand() % 5000 + 3;
|
||||
align_buffer_page_end(orig_pixels, kSize);
|
||||
MemRandomize(orig_pixels, kSize);
|
||||
|
||||
// Add SOI so frame will be scanned.
|
||||
orig_pixels[0] = 0xff;
|
||||
orig_pixels[1] = 0xd8; // SOI.
|
||||
orig_pixels[2] = 0xff;
|
||||
orig_pixels[kSize - 1] = 0xff;
|
||||
ValidateJpeg(orig_pixels,
|
||||
kSize); // Failure normally expected.
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user