mirror of
https://chromium.googlesource.com/libyuv/libyuv
synced 2025-12-08 01:36:47 +08:00
Remove duplicate function
BUG=none TEST=none Review URL: https://webrtc-codereview.appspot.com/1311006 git-svn-id: http://libyuv.googlecode.com/svn/trunk@657 16f28f9a-4ce2-e073-06de-1de4eb20be90
This commit is contained in:
parent
8c8cf8d707
commit
15c7b2fffc
@ -1,6 +1,6 @@
|
||||
Name: libyuv
|
||||
URL: http://code.google.com/p/libyuv/
|
||||
Version: 656
|
||||
Version: 657
|
||||
License: BSD
|
||||
License File: LICENSE
|
||||
|
||||
|
||||
@ -11,6 +11,6 @@
|
||||
#ifndef INCLUDE_LIBYUV_VERSION_H_ // NOLINT
|
||||
#define INCLUDE_LIBYUV_VERSION_H_
|
||||
|
||||
#define LIBYUV_VERSION 656
|
||||
#define LIBYUV_VERSION 657
|
||||
|
||||
#endif // INCLUDE_LIBYUV_VERSION_H_ NOLINT
|
||||
|
||||
@ -75,30 +75,6 @@ MJpegDecoder::~MJpegDecoder() {
|
||||
DestroyOutputBuffers();
|
||||
}
|
||||
|
||||
// Helper function to validate the jpeg looks ok.
|
||||
// TODO(fbarchard): Optimize case where SOI is found but EOI is not.
|
||||
bool ValidateJpeg(const uint8* sample, size_t sample_size) {
|
||||
if (sample_size < 64) {
|
||||
// ERROR: Invalid jpeg size: sample_size
|
||||
return false;
|
||||
}
|
||||
if (sample[0] != 0xff || sample[1] != 0xd8) { // Start Of Image
|
||||
// ERROR: Invalid jpeg initial start code
|
||||
return false;
|
||||
}
|
||||
for (int i = static_cast<int>(sample_size) - 2; i > 1;) {
|
||||
if (sample[i] != 0xd9) {
|
||||
if (sample[i] == 0xff && sample[i + 1] == 0xd9) { // End Of Image
|
||||
return true;
|
||||
}
|
||||
--i;
|
||||
}
|
||||
--i;
|
||||
}
|
||||
// ERROR: Invalid jpeg end code not found. Size sample_size
|
||||
return false;
|
||||
}
|
||||
|
||||
bool MJpegDecoder::LoadFrame(const uint8* src, size_t src_len) {
|
||||
if (!ValidateJpeg(src, src_len)) {
|
||||
return false;
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user