summaryrefslogtreecommitdiffstats
path: root/media
diff options
context:
space:
mode:
authormagjed <magjed@chromium.org>2015-04-15 01:33:09 -0700
committerCommit bot <commit-bot@chromium.org>2015-04-15 08:34:07 +0000
commit0deddb9627adb0a4d473c6e0fdafa8e32062101e (patch)
tree6a2837706a4a9eca0825b93e08cc5f360f14aa67 /media
parent673250ae542e850ddd9ff7c3c76c62bc6a66c500 (diff)
downloadchromium_src-0deddb9627adb0a4d473c6e0fdafa8e32062101e.zip
chromium_src-0deddb9627adb0a4d473c6e0fdafa8e32062101e.tar.gz
chromium_src-0deddb9627adb0a4d473c6e0fdafa8e32062101e.tar.bz2
Revert of Mac Video Capture AVFoundation: Calculate compressed frame size for MJPEG. (patchset #2 id:20001 of https://codereview.chromium.org/912293005/)
Reason for revert: An improved version of ValidateJpeg in libyuv has been rolled into chromium and this CL is no longer needed. Original issue's description: > Mac Video Capture AVFoundation: Calculate compressed frame size for MJPEG. > > The frame size we receive from AVFoundation is sometimes excessive, e.g. the size of the uncompressed frame. For example, for a JPEG YUV422, the reported size might be 1280*720*2 = 1.8MB, while the actual compressed data is only 260kB. > > In these cases, libyuv::MJPGToI420 spends a lot of time in libyuv::ValidateJpeg, as much as 25%. The reason for this is that ValidateJpeg starts at the end of the buffer and loops backwards looking for the End Of Image (EOI) marker. > > This CL tries to optimize these cases by finding the EOI by looping forwards instead of backwards, and reporting the actual frame size to libyuv::MJPGToI420. > > BUG=346634,460497 > > Committed: https://crrev.com/dc556d2b54354adc95ee5474600f469f7ae65692 > Cr-Commit-Position: refs/heads/master@{#317333} TBR=perkj@chromium.org,mcasas@chromium.org,tommi@chromium.org,torbjorng@google.com,torbjorng@chromium.org NOPRESUBMIT=true NOTREECHECKS=true NOTRY=true BUG=346634,460497 Review URL: https://codereview.chromium.org/1089173003 Cr-Commit-Position: refs/heads/master@{#325211}
Diffstat (limited to 'media')
-rw-r--r--media/video/capture/mac/video_capture_device_avfoundation_mac.mm27
1 files changed, 0 insertions, 27 deletions
diff --git a/media/video/capture/mac/video_capture_device_avfoundation_mac.mm b/media/video/capture/mac/video_capture_device_avfoundation_mac.mm
index 6d71ef8..f3c7ca7 100644
--- a/media/video/capture/mac/video_capture_device_avfoundation_mac.mm
+++ b/media/video/capture/mac/video_capture_device_avfoundation_mac.mm
@@ -6,8 +6,6 @@
#import <CoreVideo/CoreVideo.h>
-#include <cstring> // For memchr.
-
#include "base/logging.h"
#include "base/mac/foundation_util.h"
#include "media/video/capture/mac/video_capture_device_mac.h"
@@ -32,21 +30,6 @@ media::VideoPixelFormat FourCCToChromiumPixelFormat(FourCharCode code) {
}
}
-// TODO(magjed): Remove this when Chromium has the latest libyuv version.
-// Returns frame size by finding the End Of Image marker, or 0 if not found.
-size_t JpegFrameSize(const char* sample, size_t sampleSize) {
- // Jump to next marker (0xff), check for End Of Image (0xd9), repeat.
- const char* end = sample + sampleSize - 1;
- for (const char* it = sample;
- (it = static_cast<const char*>(memchr(it, 0xff, end - it)));
- ++it) {
- if (it[1] == static_cast<char>(0xd9))
- return 2 + (it - sample);
- }
- DLOG(WARNING) << "JPEG End Of Image (EOI) marker not found.";
- return 0;
-}
-
@implementation VideoCaptureDeviceAVFoundation
#pragma mark Class methods
@@ -323,16 +306,6 @@ size_t JpegFrameSize(const char* sample, size_t sampleSize) {
// Expect the MJPEG data to be available as a contiguous reference, i.e.
// not covered by multiple memory blocks.
CHECK_EQ(lengthAtOffset, frameSize);
-
- // TODO(magjed): Remove this when Chromium has the latest libyuv version.
- // If |frameSize| is suspiciously high (>= 8 bpp), calculate the actual
- // size by finding the end of image marker. The purpose is to speed up the
- // jpeg decoding in the browser.
- if (static_cast<int>(frameSize) >= dimensions.width * dimensions.height)
- frameSize = JpegFrameSize(baseAddress, frameSize);
-
- if (frameSize == 0)
- return;
}
} else {
videoFrame = CoreMediaGlue::CMSampleBufferGetImageBuffer(sampleBuffer);