Skip to content

Commit

Permalink
Formatting
Browse files Browse the repository at this point in the history
  • Loading branch information
PeterJohnson committed Dec 26, 2023
1 parent 7cac98b commit bc16bcb
Show file tree
Hide file tree
Showing 5 changed files with 21 additions and 17 deletions.
8 changes: 4 additions & 4 deletions apriltag/src/main/native/cpp/jni/AprilTagJNI.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,11 @@
// Open Source Software; you can modify and/or share it under the terms of
// the WPILib BSD license file in the root directory of this project.

#include <jni.h>

#include <cstdio>
#include <cstring>

#include <jni.h>

#define WPI_RAWFRAME_JNI
#include <wpi/RawFrame.h>
#include <wpi/jni_util.h>
Expand Down Expand Up @@ -597,7 +597,7 @@ Java_edu_wpi_first_apriltag_jni_AprilTagJNI_estimatePose
/*
* Class: edu_wpi_first_apriltag_jni_AprilTagJNI
* Method: generate16h5AprilTagImage
* Signature: (Ledu/wpi/first/util/RawFrame;JI)V
* Signature: (Ljava/lang/Object;JI)V
*/
JNIEXPORT void JNICALL
Java_edu_wpi_first_apriltag_jni_AprilTagJNI_generate16h5AprilTagImage
Expand All @@ -615,7 +615,7 @@ Java_edu_wpi_first_apriltag_jni_AprilTagJNI_generate16h5AprilTagImage
/*
* Class: edu_wpi_first_apriltag_jni_AprilTagJNI
* Method: generate36h11AprilTagImage
* Signature: (Ledu/wpi/first/util/RawFrame;JI)V
* Signature: (Ljava/lang/Object;JI)V
*/
JNIEXPORT void JNICALL
Java_edu_wpi_first_apriltag_jni_AprilTagJNI_generate36h11AprilTagImage
Expand Down
3 changes: 1 addition & 2 deletions cscore/src/main/native/cpp/RawSinkImpl.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -112,8 +112,7 @@ uint64_t RawSinkImpl::GrabFrameImpl(WPI_RawFrame& rawFrame,
rawFrame.stride = newImage->GetStride();
rawFrame.pixelFormat = newImage->pixelFormat;
rawFrame.size = newImage->size();
std::copy(newImage->data(), newImage->data() + rawFrame.size,
rawFrame.data);
std::copy(newImage->data(), newImage->data() + rawFrame.size, rawFrame.data);

return incomingFrame.GetTime();
}
Expand Down
15 changes: 9 additions & 6 deletions cscore/src/main/native/cpp/jni/CameraServerJNI.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@

#include <fmt/format.h>
#include <opencv2/core/core.hpp>

#define WPI_RAWFRAME_JNI
#include <wpi/RawFrame.h>
#include <wpi/SmallString.h>
Expand Down Expand Up @@ -1276,8 +1277,8 @@ Java_edu_wpi_first_cscore_CameraServerJNI_putRawSourceFrameBB
*/
JNIEXPORT void JNICALL
Java_edu_wpi_first_cscore_CameraServerJNI_putRawSourceFrameData
(JNIEnv* env, jclass, jint source, jlong data, jint size, jint width, jint height,
jint stride, jint pixelFormat)
(JNIEnv* env, jclass, jint source, jlong data, jint size, jint width,
jint height, jint stride, jint pixelFormat)
{
WPI_RawFrame frame; // use WPI_Frame because we don't want the destructor
frame.data = reinterpret_cast<uint8_t*>(data);
Expand Down Expand Up @@ -1770,7 +1771,8 @@ Java_edu_wpi_first_cscore_CameraServerJNI_grabRawSinkFrame
if (!CheckStatus(env, status)) {
return 0;
}
wpi::SetFrameData(env, rawFrameCls, frameObj, *frame, origData != frame->data);
wpi::SetFrameData(env, rawFrameCls, frameObj, *frame,
origData != frame->data);
return rv;
}

Expand All @@ -1787,12 +1789,13 @@ Java_edu_wpi_first_cscore_CameraServerJNI_grabRawSinkFrameTimeout
auto* frame = reinterpret_cast<wpi::RawFrame*>(framePtr);
auto origData = frame->data;
CS_Status status = 0;
auto rv = cs::GrabSinkFrameTimeout(static_cast<CS_Sink>(sink), *frame, timeout,
&status);
auto rv = cs::GrabSinkFrameTimeout(static_cast<CS_Sink>(sink), *frame,
timeout, &status);
if (!CheckStatus(env, status)) {
return 0;
}
wpi::SetFrameData(env, rawFrameCls, frameObj, *frame, origData != frame->data);
wpi::SetFrameData(env, rawFrameCls, frameObj, *frame,
origData != frame->data);
return rv;
}

Expand Down
4 changes: 2 additions & 2 deletions wpiutil/src/main/native/cpp/RawFrame.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,10 @@

#include "wpi/RawFrame.h"

#include <cstring>

#include <wpi/MemAlloc.h>

#include <cstring>

extern "C" {
int WPI_AllocateRawFrameData(WPI_RawFrame* frame, size_t requestedSize) {
if (frame->capacity >= requestedSize) {
Expand Down
8 changes: 5 additions & 3 deletions wpiutil/src/main/native/cpp/jni/WPIUtilJNI.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -362,11 +362,12 @@ Java_edu_wpi_first_util_WPIUtilJNI_getRawFrameDataPtr
/*
* Class: edu_wpi_first_util_WPIUtilJNI
* Method: setRawFrameData
* Signature: (JLjava/nio/ByteBuffer;IIIII)V
* Signature: (JLjava/lang/Object;IIIII)V
*/
JNIEXPORT void JNICALL
Java_edu_wpi_first_util_WPIUtilJNI_setRawFrameData
(JNIEnv* env, jclass, jlong frame, jobject data, jint size, jint width, jint height, jint stride, jint pixelFormat)
(JNIEnv* env, jclass, jlong frame, jobject data, jint size, jint width,
jint height, jint stride, jint pixelFormat)
{
auto* f = reinterpret_cast<wpi::RawFrame*>(frame);
if (!f) {
Expand Down Expand Up @@ -394,7 +395,8 @@ Java_edu_wpi_first_util_WPIUtilJNI_setRawFrameData
*/
JNIEXPORT void JNICALL
Java_edu_wpi_first_util_WPIUtilJNI_setRawFrameInfo
(JNIEnv* env, jclass, jlong frame, jint size, jint width, jint height, jint stride, jint pixelFormat)
(JNIEnv* env, jclass, jlong frame, jint size, jint width, jint height,
jint stride, jint pixelFormat)
{
auto* f = reinterpret_cast<wpi::RawFrame*>(frame);
if (!f) {
Expand Down

0 comments on commit bc16bcb

Please sign in to comment.