aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorandroid-build-team Robot <android-build-team-robot@google.com>2018-04-15 07:21:29 +0000
committerandroid-build-team Robot <android-build-team-robot@google.com>2018-04-15 07:21:29 +0000
commit77261e539880708ecb2492d646b0eee83d159f18 (patch)
tree0e0c15e0b7684a7e4d9c3180eb282c865aae2d33
parent28969441ca56d4348d25e1e82d6379b1911ef130 (diff)
parentb98a027712418506c6a4c2aa9319e02801e7ff34 (diff)
downloadv4l2_codec2-77261e539880708ecb2492d646b0eee83d159f18.tar.gz
Snap for 4722539 from b98a027712418506c6a4c2aa9319e02801e7ff34 to pi-release
Change-Id: Ia4d81cc1c07b8b2f41986e9b4364879efafeb3df
-rw-r--r--C2VDAComponent.cpp14
-rw-r--r--tests/C2VDAComponent_test.cpp23
-rw-r--r--tests/data/bear-vp8.webm.md54
-rw-r--r--tests/data/bear-vp9.webm.md54
-rw-r--r--tests/data/bear.mp4.md54
5 files changed, 35 insertions, 14 deletions
diff --git a/C2VDAComponent.cpp b/C2VDAComponent.cpp
index 7718229..8a25388 100644
--- a/C2VDAComponent.cpp
+++ b/C2VDAComponent.cpp
@@ -458,7 +458,7 @@ std::unique_ptr<C2SettingResult> C2VDAComponentIntf::validateUint32Config(C2Para
class C2VDAGraphicBuffer : public C2Buffer {
public:
- C2VDAGraphicBuffer(const std::shared_ptr<C2GraphicBlock>& block,
+ C2VDAGraphicBuffer(const std::shared_ptr<C2GraphicBlock>& block, const media::Rect& visibleRect,
const base::Closure& releaseCB);
~C2VDAGraphicBuffer() override;
@@ -467,8 +467,9 @@ private:
};
C2VDAGraphicBuffer::C2VDAGraphicBuffer(const std::shared_ptr<C2GraphicBlock>& block,
+ const media::Rect& visibleRect,
const base::Closure& releaseCB)
- : C2Buffer({block->share(C2Rect(block->width(), block->height()), C2Fence())}),
+ : C2Buffer({block->share(C2Rect(visibleRect.width(), visibleRect.height()), C2Fence())}),
mReleaseCB(releaseCB) {}
C2VDAGraphicBuffer::~C2VDAGraphicBuffer() {
@@ -703,8 +704,9 @@ void C2VDAComponent::onOutputBufferDone(int32_t pictureBufferId, int32_t bitstre
// Attach output buffer to the work corresponded to bitstreamId.
work->worklets.front()->output.buffers.emplace_back(std::make_shared<C2VDAGraphicBuffer>(
- info->mGraphicBlock, base::Bind(&C2VDAComponent::returnOutputBuffer,
- mWeakThisFactory.GetWeakPtr(), pictureBufferId)));
+ info->mGraphicBlock, mOutputFormat.mVisibleRect,
+ base::Bind(&C2VDAComponent::returnOutputBuffer, mWeakThisFactory.GetWeakPtr(),
+ pictureBufferId)));
// TODO: this does not work for timestamps as they can wrap around
int64_t currentTimestamp = base::checked_cast<int64_t>(work->input.ordinal.timestamp.peek());
@@ -1093,9 +1095,9 @@ void C2VDAComponent::onVisibleRectChanged(const media::Rect& cropRect) {
void C2VDAComponent::setOutputFormatCrop(const media::Rect& cropRect) {
ALOGV("setOutputFormatCrop(%dx%d)", cropRect.width(), cropRect.height());
+ // This visible rect should be set as crop window for each C2ConstGraphicBlock passed to
+ // framework.
mOutputFormat.mVisibleRect = cropRect;
- // TODO(johnylin): what else do we need to do? crop rect could be an info requested from
- // framework by requestedInfos in worklets.
}
c2_status_t C2VDAComponent::queue_nb(std::list<std::unique_ptr<C2Work>>* const items) {
diff --git a/tests/C2VDAComponent_test.cpp b/tests/C2VDAComponent_test.cpp
index efbba6e..6bc6289 100644
--- a/tests/C2VDAComponent_test.cpp
+++ b/tests/C2VDAComponent_test.cpp
@@ -111,9 +111,9 @@ namespace android {
// - |width| and |height| are for video size (in pixels).
// - |numFrames| is the number of picture frames.
// - |numFragments| is the NALU (h264) or frame (VP8/9) count by MediaExtractor.
-const char* gTestVideoData = "bear.mp4:c2.vda.avc.decoder:640:368:82:84";
-//const char* gTestVideoData = "bear-vp8.webm:c2.vda.vp8.decoder:640:368:82:82";
-//const char* gTestVideoData = "bear-vp9.webm:c2.vda.vp9.decoder:320:256:82:82";
+const char* gTestVideoData = "bear.mp4:c2.vda.avc.decoder:640:360:82:84";
+//const char* gTestVideoData = "bear-vp8.webm:c2.vda.vp8.decoder:640:360:82:82";
+//const char* gTestVideoData = "bear-vp9.webm:c2.vda.vp9.decoder:320:240:82:82";
// Record decoded output frames as raw YUV format.
// The recorded file will be named as "<video_name>_output_<width>x<height>.yuv" under the same
@@ -506,8 +506,21 @@ TEST_P(C2VDAComponentParamTest, SimpleDecodeTest) {
if (work->worklets.front()->output.buffers.size() == 1u) {
std::shared_ptr<C2Buffer> output = work->worklets.front()->output.buffers[0];
C2ConstGraphicBlock graphicBlock = output->data().graphicBlocks().front();
- ASSERT_EQ(mTestVideoFile->mWidth, static_cast<int>(graphicBlock.width()));
- ASSERT_EQ(mTestVideoFile->mHeight, static_cast<int>(graphicBlock.height()));
+
+ // check graphic buffer size (coded size) is not less than given video size.
+ ASSERT_LE(mTestVideoFile->mWidth, static_cast<int>(graphicBlock.width()));
+ ASSERT_LE(mTestVideoFile->mHeight, static_cast<int>(graphicBlock.height()));
+
+ // check visible rect equals to given video size.
+ ASSERT_EQ(mTestVideoFile->mWidth, static_cast<int>(graphicBlock.crop().width));
+ ASSERT_EQ(mTestVideoFile->mHeight, static_cast<int>(graphicBlock.crop().height));
+ ASSERT_EQ(0u, graphicBlock.crop().left);
+ ASSERT_EQ(0u, graphicBlock.crop().top);
+
+ // Intended behavior for Intel libva driver (crbug.com/148546):
+ // The 5ms latency is laid here to make sure surface content is finished processed
+ // processed by libva.
+ std::this_thread::sleep_for(std::chrono::milliseconds(5));
const C2GraphicView& constGraphicView = graphicBlock.map().get();
ASSERT_EQ(C2_OK, constGraphicView.error());
diff --git a/tests/data/bear-vp8.webm.md5 b/tests/data/bear-vp8.webm.md5
index 58ce33f..25d983c 100644
--- a/tests/data/bear-vp8.webm.md5
+++ b/tests/data/bear-vp8.webm.md5
@@ -1,3 +1,5 @@
-# gTestVideoData = "bear-vp8.webm:v4l2.vp8.decode:640:368:82:82"
+# gTestVideoData = "bear-vp8.webm:c2.vda.vp8.decoder:640:360:82:82"
# ARM - Mali
056a2484b34bc78637b37b36481027c6
+# Intel
+fdc9d348b06a77e65a8aa0ccc120c6f9
diff --git a/tests/data/bear-vp9.webm.md5 b/tests/data/bear-vp9.webm.md5
index 093f40e..99810d5 100644
--- a/tests/data/bear-vp9.webm.md5
+++ b/tests/data/bear-vp9.webm.md5
@@ -1,3 +1,5 @@
-# gTestVideoData = "bear-vp9.webm:v4l2.vp9.decode:320:256:82:82"
+# gTestVideoData = "bear-vp9.webm:c2.vda.vp9.decoder:320:240:82:82"
# ARM - Mali
7228c16473724e4dff2fc55edcf94683
+# Intel
+058213ed7a7e119838564001b7ee8004
diff --git a/tests/data/bear.mp4.md5 b/tests/data/bear.mp4.md5
index 388da15..d8f8c2d 100644
--- a/tests/data/bear.mp4.md5
+++ b/tests/data/bear.mp4.md5
@@ -1,3 +1,5 @@
-# gTestVideoData = "bear.mp4:v4l2.h264.decode:640:368:82:84"
+# gTestVideoData = "bear.mp4:c2.vda.avc.decoder:640:360:82:84"
# ARM - Mali
a3ea733a472e222608d690e91e6c88cc
+# Intel
+431076e337c24fe71a50ae07c64fdf3c