Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -1,9 +1,6 @@
// Copyright 2013 The Flutter Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
//
// Note: the code in this file is taken directly from the official Google MLKit example:
// https://github.com/googlesamples/mlkit

package io.flutter.plugins.camera.media;

Expand All @@ -28,8 +25,6 @@ public class ImageStreamReaderUtils {
* NV21 format. This happens if the planes share the same buffer, the V buffer is one position
* before the U buffer and the planes have a pixelStride of 2. If this is case, we can just copy
* them to the NV21 array.
*
* <p>https://github.com/googlesamples/mlkit/blob/master/android/vision-quickstart/app/src/main/java/com/google/mlkit/vision/demo/BitmapUtils.java
*/
@NonNull
public ByteBuffer yuv420ThreePlanesToNV21(
Expand Down Expand Up @@ -60,23 +55,7 @@ public ByteBuffer yuv420ThreePlanesToNV21(
return ByteBuffer.wrap(out);
}

/**
* Copyright 2020 Google LLC. All rights reserved.
*
* <p>Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file
* except in compliance with the License. You may obtain a copy of the License at
*
* <p>http://www.apache.org/licenses/LICENSE-2.0
*
* <p>Unless required by applicable law or agreed to in writing, software distributed under the
* License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND,
* either express or implied. See the License for the specific language governing permissions and
* limitations under the License.
*
* <p>Checks if the UV plane buffers of a YUV_420_888 image are in the NV21 format.
*
* <p>https://github.com/googlesamples/mlkit/blob/master/android/vision-quickstart/app/src/main/java/com/google/mlkit/vision/demo/BitmapUtils.java
*/
/** Checks if the UV plane buffers of a YUV_420_888 image are in the NV21 format. */
private static boolean areUVPlanesNV21(@NonNull Image.Plane[] planes, int width, int height) {
int imageSize = width * height;

Expand Down Expand Up @@ -104,24 +83,10 @@ private static boolean areUVPlanesNV21(@NonNull Image.Plane[] planes, int width,
}

/**
* Copyright 2020 Google LLC. All rights reserved.
*
* <p>Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file
* except in compliance with the License. You may obtain a copy of the License at
*
* <p>http://www.apache.org/licenses/LICENSE-2.0
*
* <p>Unless required by applicable law or agreed to in writing, software distributed under the
* License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND,
* either express or implied. See the License for the specific language governing permissions and
* limitations under the License.
*
* <p>Unpack an image plane into a byte array.
* Unpack an image plane into a byte array.
*
* <p>The input plane data will be copied in 'out', starting at 'offset' and every pixel will be
* spaced by 'pixelStride'. Note that there is no row padding on the output.
*
* <p>https://github.com/googlesamples/mlkit/blob/master/android/vision-quickstart/app/src/main/java/com/google/mlkit/vision/demo/BitmapUtils.java
*/
private static void unpackPlane(
@NonNull Image.Plane plane, int width, int height, byte[] out, int offset, int pixelStride)
Expand Down