diff options
author | Ram Mohan M | 2017-08-09 01:41:23 -0500 |
---|---|---|
committer | Pawin Vongmasa | 2017-08-17 07:31:33 -0500 |
commit | 9ce313a7b3d6dba0fb1b2fa1888fcb4824a022c8 (patch) | |
tree | b1f75da9fa9994663e523ae81a3b771f98830144 /media/omx/1.0/vts/functional/video/VtsHalMediaOmxV1_0TargetVideoDecTest.cpp | |
parent | e2dae8c2581172001f16a88ad555c401e6b42d34 (diff) | |
download | platform-hardware-interfaces-9ce313a7b3d6dba0fb1b2fa1888fcb4824a022c8.tar.gz platform-hardware-interfaces-9ce313a7b3d6dba0fb1b2fa1888fcb4824a022c8.tar.xz platform-hardware-interfaces-9ce313a7b3d6dba0fb1b2fa1888fcb4824a022c8.zip |
bug fix: configure input port buffer size
In video decoders, size of a single input frame (elementary-stream)
is dependent on width, height, color format, profile settings, ...
Most of this information is part of sps, pps and requires parsing.
But as the max size of the stream is known ahead, use it to configure
the input buffer size requirements
Bug: 63875287
Bug: 63796949
Merged-In: Ib760c4f55b094260a0abd120f852dcf1899df4e0
Change-Id: Ib760c4f55b094260a0abd120f852dcf1899df4e0
Diffstat (limited to 'media/omx/1.0/vts/functional/video/VtsHalMediaOmxV1_0TargetVideoDecTest.cpp')
-rw-r--r-- | media/omx/1.0/vts/functional/video/VtsHalMediaOmxV1_0TargetVideoDecTest.cpp | 52 |
1 files changed, 48 insertions, 4 deletions
diff --git a/media/omx/1.0/vts/functional/video/VtsHalMediaOmxV1_0TargetVideoDecTest.cpp b/media/omx/1.0/vts/functional/video/VtsHalMediaOmxV1_0TargetVideoDecTest.cpp index 9773cb00..f13d88c1 100644 --- a/media/omx/1.0/vts/functional/video/VtsHalMediaOmxV1_0TargetVideoDecTest.cpp +++ b/media/omx/1.0/vts/functional/video/VtsHalMediaOmxV1_0TargetVideoDecTest.cpp | |||
@@ -768,7 +768,7 @@ TEST_F(VideoDecHidlTest, DecodeTest) { | |||
768 | eleInfo.open(info); | 768 | eleInfo.open(info); |
769 | ASSERT_EQ(eleInfo.is_open(), true); | 769 | ASSERT_EQ(eleInfo.is_open(), true); |
770 | android::Vector<FrameData> Info; | 770 | android::Vector<FrameData> Info; |
771 | int bytesCount = 0; | 771 | int bytesCount = 0, maxBytesCount = 0; |
772 | uint32_t flags = 0; | 772 | uint32_t flags = 0; |
773 | uint32_t timestamp = 0; | 773 | uint32_t timestamp = 0; |
774 | timestampDevTest = true; | 774 | timestampDevTest = true; |
@@ -779,9 +779,15 @@ TEST_F(VideoDecHidlTest, DecodeTest) { | |||
779 | Info.push_back({bytesCount, flags, timestamp}); | 779 | Info.push_back({bytesCount, flags, timestamp}); |
780 | if (flags != OMX_BUFFERFLAG_CODECCONFIG) | 780 | if (flags != OMX_BUFFERFLAG_CODECCONFIG) |
781 | timestampUslist.push_back(timestamp); | 781 | timestampUslist.push_back(timestamp); |
782 | if (maxBytesCount < bytesCount) maxBytesCount = bytesCount; | ||
782 | } | 783 | } |
783 | eleInfo.close(); | 784 | eleInfo.close(); |
784 | 785 | ||
786 | // As the frame sizes are known ahead, use it to configure i/p buffer size | ||
787 | maxBytesCount = ALIGN_POWER_OF_TWO(maxBytesCount, 10); | ||
788 | status = setPortBufferSize(omxNode, kPortIndexInput, maxBytesCount); | ||
789 | ASSERT_EQ(status, ::android::hardware::media::omx::V1_0::Status::OK); | ||
790 | |||
785 | // set port mode | 791 | // set port mode |
786 | portMode[0] = PortMode::PRESET_BYTE_BUFFER; | 792 | portMode[0] = PortMode::PRESET_BYTE_BUFFER; |
787 | portMode[1] = PortMode::DYNAMIC_ANW_BUFFER; | 793 | portMode[1] = PortMode::DYNAMIC_ANW_BUFFER; |
@@ -801,6 +807,8 @@ TEST_F(VideoDecHidlTest, DecodeTest) { | |||
801 | &xFramerate); | 807 | &xFramerate); |
802 | setDefaultPortParam(omxNode, kPortIndexOutput, OMX_VIDEO_CodingUnused, | 808 | setDefaultPortParam(omxNode, kPortIndexOutput, OMX_VIDEO_CodingUnused, |
803 | eColorFormat, nFrameWidth, nFrameHeight, 0, xFramerate); | 809 | eColorFormat, nFrameWidth, nFrameHeight, 0, xFramerate); |
810 | |||
811 | // disabling adaptive playback. | ||
804 | omxNode->prepareForAdaptivePlayback(kPortIndexOutput, false, 1920, 1080); | 812 | omxNode->prepareForAdaptivePlayback(kPortIndexOutput, false, 1920, 1080); |
805 | 813 | ||
806 | android::Vector<BufferInfo> iBuffer, oBuffer; | 814 | android::Vector<BufferInfo> iBuffer, oBuffer; |
@@ -923,7 +931,7 @@ TEST_F(VideoDecHidlTest, ThumbnailTest) { | |||
923 | eleInfo.open(info); | 931 | eleInfo.open(info); |
924 | ASSERT_EQ(eleInfo.is_open(), true); | 932 | ASSERT_EQ(eleInfo.is_open(), true); |
925 | android::Vector<FrameData> Info; | 933 | android::Vector<FrameData> Info; |
926 | int bytesCount = 0; | 934 | int bytesCount = 0, maxBytesCount = 0; |
927 | uint32_t flags = 0; | 935 | uint32_t flags = 0; |
928 | uint32_t timestamp = 0; | 936 | uint32_t timestamp = 0; |
929 | while (1) { | 937 | while (1) { |
@@ -931,9 +939,21 @@ TEST_F(VideoDecHidlTest, ThumbnailTest) { | |||
931 | eleInfo >> flags; | 939 | eleInfo >> flags; |
932 | eleInfo >> timestamp; | 940 | eleInfo >> timestamp; |
933 | Info.push_back({bytesCount, flags, timestamp}); | 941 | Info.push_back({bytesCount, flags, timestamp}); |
942 | if (maxBytesCount < bytesCount) maxBytesCount = bytesCount; | ||
934 | } | 943 | } |
935 | eleInfo.close(); | 944 | eleInfo.close(); |
936 | 945 | ||
946 | // As the frame sizes are known ahead, use it to configure i/p buffer size | ||
947 | maxBytesCount = ALIGN_POWER_OF_TWO(maxBytesCount, 10); | ||
948 | status = setPortBufferSize(omxNode, kPortIndexInput, maxBytesCount); | ||
949 | ASSERT_EQ(status, ::android::hardware::media::omx::V1_0::Status::OK); | ||
950 | |||
951 | // set port mode | ||
952 | status = omxNode->setPortMode(kPortIndexInput, portMode[0]); | ||
953 | ASSERT_EQ(status, ::android::hardware::media::omx::V1_0::Status::OK); | ||
954 | status = omxNode->setPortMode(kPortIndexOutput, portMode[1]); | ||
955 | ASSERT_EQ(status, ::android::hardware::media::omx::V1_0::Status::OK); | ||
956 | |||
937 | // set Port Params | 957 | // set Port Params |
938 | uint32_t nFrameWidth, nFrameHeight, xFramerate; | 958 | uint32_t nFrameWidth, nFrameHeight, xFramerate; |
939 | OMX_COLOR_FORMATTYPE eColorFormat = OMX_COLOR_FormatYUV420Planar; | 959 | OMX_COLOR_FORMATTYPE eColorFormat = OMX_COLOR_FormatYUV420Planar; |
@@ -1024,7 +1044,7 @@ TEST_F(VideoDecHidlTest, SimpleEOSTest) { | |||
1024 | eleInfo.open(info); | 1044 | eleInfo.open(info); |
1025 | ASSERT_EQ(eleInfo.is_open(), true); | 1045 | ASSERT_EQ(eleInfo.is_open(), true); |
1026 | android::Vector<FrameData> Info; | 1046 | android::Vector<FrameData> Info; |
1027 | int bytesCount = 0; | 1047 | int bytesCount = 0, maxBytesCount = 0; |
1028 | uint32_t flags = 0; | 1048 | uint32_t flags = 0; |
1029 | uint32_t timestamp = 0; | 1049 | uint32_t timestamp = 0; |
1030 | while (1) { | 1050 | while (1) { |
@@ -1032,9 +1052,21 @@ TEST_F(VideoDecHidlTest, SimpleEOSTest) { | |||
1032 | eleInfo >> flags; | 1052 | eleInfo >> flags; |
1033 | eleInfo >> timestamp; | 1053 | eleInfo >> timestamp; |
1034 | Info.push_back({bytesCount, flags, timestamp}); | 1054 | Info.push_back({bytesCount, flags, timestamp}); |
1055 | if (maxBytesCount < bytesCount) maxBytesCount = bytesCount; | ||
1035 | } | 1056 | } |
1036 | eleInfo.close(); | 1057 | eleInfo.close(); |
1037 | 1058 | ||
1059 | // As the frame sizes are known ahead, use it to configure i/p buffer size | ||
1060 | maxBytesCount = ALIGN_POWER_OF_TWO(maxBytesCount, 10); | ||
1061 | status = setPortBufferSize(omxNode, kPortIndexInput, maxBytesCount); | ||
1062 | ASSERT_EQ(status, ::android::hardware::media::omx::V1_0::Status::OK); | ||
1063 | |||
1064 | // set port mode | ||
1065 | status = omxNode->setPortMode(kPortIndexInput, portMode[0]); | ||
1066 | ASSERT_EQ(status, ::android::hardware::media::omx::V1_0::Status::OK); | ||
1067 | status = omxNode->setPortMode(kPortIndexOutput, portMode[1]); | ||
1068 | ASSERT_EQ(status, ::android::hardware::media::omx::V1_0::Status::OK); | ||
1069 | |||
1038 | // set Port Params | 1070 | // set Port Params |
1039 | uint32_t nFrameWidth, nFrameHeight, xFramerate; | 1071 | uint32_t nFrameWidth, nFrameHeight, xFramerate; |
1040 | OMX_COLOR_FORMATTYPE eColorFormat = OMX_COLOR_FormatYUV420Planar; | 1072 | OMX_COLOR_FORMATTYPE eColorFormat = OMX_COLOR_FormatYUV420Planar; |
@@ -1107,7 +1139,7 @@ TEST_F(VideoDecHidlTest, FlushTest) { | |||
1107 | eleInfo.open(info); | 1139 | eleInfo.open(info); |
1108 | ASSERT_EQ(eleInfo.is_open(), true); | 1140 | ASSERT_EQ(eleInfo.is_open(), true); |
1109 | android::Vector<FrameData> Info; | 1141 | android::Vector<FrameData> Info; |
1110 | int bytesCount = 0; | 1142 | int bytesCount = 0, maxBytesCount = 0; |
1111 | uint32_t flags = 0; | 1143 | uint32_t flags = 0; |
1112 | uint32_t timestamp = 0; | 1144 | uint32_t timestamp = 0; |
1113 | while (1) { | 1145 | while (1) { |
@@ -1115,9 +1147,21 @@ TEST_F(VideoDecHidlTest, FlushTest) { | |||
1115 | eleInfo >> flags; | 1147 | eleInfo >> flags; |
1116 | eleInfo >> timestamp; | 1148 | eleInfo >> timestamp; |
1117 | Info.push_back({bytesCount, flags, timestamp}); | 1149 | Info.push_back({bytesCount, flags, timestamp}); |
1150 | if (maxBytesCount < bytesCount) maxBytesCount = bytesCount; | ||
1118 | } | 1151 | } |
1119 | eleInfo.close(); | 1152 | eleInfo.close(); |
1120 | 1153 | ||
1154 | // As the frame sizes are known ahead, use it to configure i/p buffer size | ||
1155 | maxBytesCount = ALIGN_POWER_OF_TWO(maxBytesCount, 10); | ||
1156 | status = setPortBufferSize(omxNode, kPortIndexInput, maxBytesCount); | ||
1157 | ASSERT_EQ(status, ::android::hardware::media::omx::V1_0::Status::OK); | ||
1158 | |||
1159 | // set port mode | ||
1160 | status = omxNode->setPortMode(kPortIndexInput, portMode[0]); | ||
1161 | ASSERT_EQ(status, ::android::hardware::media::omx::V1_0::Status::OK); | ||
1162 | status = omxNode->setPortMode(kPortIndexOutput, portMode[1]); | ||
1163 | ASSERT_EQ(status, ::android::hardware::media::omx::V1_0::Status::OK); | ||
1164 | |||
1121 | // set Port Params | 1165 | // set Port Params |
1122 | uint32_t nFrameWidth, nFrameHeight, xFramerate; | 1166 | uint32_t nFrameWidth, nFrameHeight, xFramerate; |
1123 | OMX_COLOR_FORMATTYPE eColorFormat = OMX_COLOR_FormatYUV420Planar; | 1167 | OMX_COLOR_FORMATTYPE eColorFormat = OMX_COLOR_FormatYUV420Planar; |