File tree Expand file tree Collapse file tree 4 files changed +17
-12
lines changed
tensorflow_lite_support/c/task/vision Expand file tree Collapse file tree 4 files changed +17
-12
lines changed Original file line number Diff line number Diff line change @@ -183,14 +183,8 @@ TfLiteClassificationResult* TfLiteImageClassifierClassifyWithRoi(
183183 return nullptr ;
184184 }
185185
186- if (frame_buffer == nullptr ) {
187- ::tflite::support::CreateTfLiteSupportError (
188- kInvalidArgumentError , " Expected non null frame buffer." , error);
189- return nullptr ;
190- }
191-
192186 StatusOr<std::unique_ptr<FrameBufferCpp>> cpp_frame_buffer_status =
193- ::tflite::task::vision::CreateCppFrameBuffer (* frame_buffer);
187+ ::tflite::task::vision::CreateCppFrameBuffer (frame_buffer);
194188 if (!cpp_frame_buffer_status.ok ()) {
195189 tflite::support::CreateTfLiteSupportErrorWithStatus (
196190 cpp_frame_buffer_status.status (), error);
Original file line number Diff line number Diff line change @@ -16,5 +16,6 @@ cc_library(
1616 deps = [
1717 "//tensorflow_lite_support/c/task/vision/core:frame_buffer" ,
1818 "//tensorflow_lite_support/cc/task/vision/utils:frame_buffer_common_utils" ,
19+ "//tensorflow_lite_support/cc:common" ,
1920 ],
2021)
Original file line number Diff line number Diff line change @@ -15,23 +15,33 @@ limitations under the License.
1515
1616#include " tensorflow_lite_support/c/task/vision/utils/frame_buffer_cpp_c_utils.h"
1717
18+ #include " external/com_google_absl/absl/strings/str_format.h"
19+ #include " tensorflow_lite_support/cc/common.h"
20+
1821namespace tflite {
1922namespace task {
2023namespace vision {
2124
2225namespace {
2326using FrameBufferCpp = ::tflite::task::vision::FrameBuffer;
2427using ::tflite::support::StatusOr;
28+ using ::tflite::support::TfLiteSupportStatus;
2529} // namespace
2630
2731StatusOr<std::unique_ptr<FrameBufferCpp>> CreateCppFrameBuffer (
28- const TfLiteFrameBuffer& frame_buffer) {
32+ const TfLiteFrameBuffer* frame_buffer) {
33+ if (frame_buffer == nullptr )
34+ return CreateStatusWithPayload (
35+ absl::StatusCode::kInvalidArgument ,
36+ absl::StrFormat (" Expected non null frame buffer." ),
37+ TfLiteSupportStatus::kInvalidArgumentError );
38+
2939 FrameBufferCpp::Format frame_buffer_format =
30- FrameBufferCpp::Format (frame_buffer. format );
40+ FrameBufferCpp::Format (frame_buffer-> format );
3141
3242 return CreateFromRawBuffer (
33- frame_buffer. buffer ,
34- {frame_buffer. dimension .width , frame_buffer. dimension .height },
43+ frame_buffer-> buffer ,
44+ {frame_buffer-> dimension .width , frame_buffer-> dimension .height },
3545 frame_buffer_format);
3646}
3747
Original file line number Diff line number Diff line change @@ -28,7 +28,7 @@ namespace task {
2828namespace vision {
2929
3030tflite::support::StatusOr<std::unique_ptr<tflite::task::vision::FrameBuffer>>
31- CreateCppFrameBuffer (const TfLiteFrameBuffer& frame_buffer);
31+ CreateCppFrameBuffer (const TfLiteFrameBuffer* frame_buffer);
3232
3333} // namespace vision
3434} // namespace task
You can’t perform that action at this time.
0 commit comments