summaryrefslogtreecommitdiffstats
path: root/media
diff options
context:
space:
mode:
authorhclam@chromium.org <hclam@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2009-12-02 00:01:55 +0000
committerhclam@chromium.org <hclam@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2009-12-02 00:01:55 +0000
commit3d9cb80176153b74d62b0d67d27744b338f2a5f1 (patch)
tree34f7b676b0f2a7150d06cf222f51a4b326ce9663 /media
parentf6ad5c0d828d3fcb99b01fc603bc47b23237fec7 (diff)
downloadchromium_src-3d9cb80176153b74d62b0d67d27744b338f2a5f1.zip
chromium_src-3d9cb80176153b74d62b0d67d27744b338f2a5f1.tar.gz
chromium_src-3d9cb80176153b74d62b0d67d27744b338f2a5f1.tar.bz2
Benchmark memcpy of the output of OpenMAX decoder
Add --copy option to omx_test for benchmarking memcpy performance from the output of OpenMAX decoder. Review URL: http://codereview.chromium.org/450031 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@33513 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'media')
-rw-r--r--media/omx/omx_test.cc27
1 files changed, 23 insertions, 4 deletions
diff --git a/media/omx/omx_test.cc b/media/omx/omx_test.cc
index 3b8b22e..1bebce4 100644
--- a/media/omx/omx_test.cc
+++ b/media/omx/omx_test.cc
@@ -25,10 +25,13 @@ class TestApp {
public:
TestApp(const char* filename,
const char* component,
- media::OmxVideoDecoder::Codec codec)
+ media::OmxVideoDecoder::Codec codec,
+ bool simulate_copy)
: filename_(filename),
component_(component),
codec_(codec),
+ simulate_copy_(simulate_copy),
+ copy_buf_size_(0),
stopped_(false),
error_(false) {
}
@@ -77,6 +80,15 @@ class TestApp {
// Read one more from the decoder.
decoder_->Read(NewCallback(this, &TestApp::ReadCompleteCallback));
+
+ // Copy the output of the decoder to user memory.
+ if (simulate_copy_) {
+ if (size > copy_buf_size_) {
+ copy_buf_.reset(new uint8[size]);
+ copy_buf_size_ = size;
+ }
+ memcpy(copy_buf_.get(), buffer, size);
+ }
}
void FeedDecoder() {
@@ -118,6 +130,9 @@ class TestApp {
const char* filename_;
const char* component_;
media::OmxVideoDecoder::Codec codec_;
+ bool simulate_copy_;
+ scoped_array<uint8> copy_buf_;
+ int copy_buf_size_;
FILE* file_;
bool stopped_;
bool error_;
@@ -130,16 +145,20 @@ int main(int argc, char** argv) {
const CommandLine* cmd_line = CommandLine::ForCurrentProcess();
if (argc < 2) {
- printf("Usage: %s --file=FILE --component=COMPONENT --codec=CODEC\n",
- argv[0]);
+ printf("Usage: omx_test --file=FILE --component=COMPONENT --codec=CODEC"
+ " [--copy]\n");
printf(" COMPONENT: OpenMAX component name\n");
printf(" CODEC: h264/mpeg4/h263/vc1\n");
+ printf("\n");
+ printf("Optional Arguments\n");
+ printf(" --copy Simulate a memcpy from the output of decoder.\n");
return 1;
}
std::string filename = cmd_line->GetSwitchValueASCII("file");
std::string component = cmd_line->GetSwitchValueASCII("component");
std::string codec = cmd_line->GetSwitchValueASCII("codec");
+ bool copy = cmd_line->HasSwitch("copy");
media::OmxVideoDecoder::Codec codec_id = media::OmxVideoDecoder::kCodecNone;
if (codec == "h264")
@@ -156,7 +175,7 @@ int main(int argc, char** argv) {
}
// Create a TestApp object and run the decoder.
- TestApp test(filename.c_str(), component.c_str(), codec_id);
+ TestApp test(filename.c_str(), component.c_str(), codec_id, copy);
// This call will run the decoder until EOS is reached or an error
// is encountered.