Skip to content

Commit

Permalink
Remove debugging logs
Browse files Browse the repository at this point in the history
  • Loading branch information
DichenZhang1 committed Apr 11, 2024
1 parent c82e44a commit 7c04177
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 33 deletions.
2 changes: 1 addition & 1 deletion CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -364,7 +364,7 @@ set_property(DIRECTORY PROPERTY ADDITIONAL_MAKE_CLEAN_FILES
# File Lists
###########################################################
file(GLOB UHDR_CORE_SRCS_LIST "${SOURCE_DIR}/src/*.cpp")
file(GLOB UHDR_TEST_SRCS_LIST "${TESTS_DIR}/ultrahdr_test.cpp")
file(GLOB UHDR_TEST_SRCS_LIST "${TESTS_DIR}/*.cpp")
file(GLOB UHDR_BM_SRCS_LIST "${BENCHMARK_DIR}/*.cpp")
file(GLOB IMAGE_IO_SRCS_LIST "${THIRD_PARTY_DIR}/image_io/src/**/*.cc")

Expand Down
26 changes: 0 additions & 26 deletions lib/src/jpegr.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -577,8 +577,6 @@ status_t JpegR::encodeJPEGR(uhdr_uncompressed_ptr yuv420_image_ptr, uhdr_uncompr
return ERROR_ULTRAHDR_BAD_PTR;
}

printf("[dichenzhang] encodeJPEGR() api-x: pos 1\n");

// clean up input structure for later usage
ultrahdr_uncompressed_struct yuv420_image = *yuv420_image_ptr;
if (yuv420_image.luma_stride == 0) yuv420_image.luma_stride = yuv420_image.width;
Expand All @@ -588,8 +586,6 @@ status_t JpegR::encodeJPEGR(uhdr_uncompressed_ptr yuv420_image_ptr, uhdr_uncompr
yuv420_image.chroma_stride = yuv420_image.luma_stride >> 1;
}

printf("[dichenzhang] encodeJPEGR() api-x: pos 2\n");

// compress gain map
JpegEncoderHelper jpeg_enc_obj_gm;
ULTRAHDR_CHECK(compressGainMap(gainmap_image_ptr, &jpeg_enc_obj_gm));
Expand All @@ -602,8 +598,6 @@ status_t JpegR::encodeJPEGR(uhdr_uncompressed_ptr yuv420_image_ptr, uhdr_uncompr
std::shared_ptr<DataStruct> icc =
IccHelper::writeIccProfile(ULTRAHDR_TF_SRGB, yuv420_image.colorGamut);

printf("[dichenzhang] encodeJPEGR() api-x: pos 3\n");

// compress 420 image
JpegEncoderHelper jpeg_enc_obj_yuv420;
if (!jpeg_enc_obj_yuv420.compressImage(
Expand All @@ -614,8 +608,6 @@ status_t JpegR::encodeJPEGR(uhdr_uncompressed_ptr yuv420_image_ptr, uhdr_uncompr
return ERROR_ULTRAHDR_ENCODE_ERROR;
}

printf("[dichenzhang] encodeJPEGR() api-x: pos 4\n");

ultrahdr_compressed_struct jpeg;
jpeg.data = jpeg_enc_obj_yuv420.getCompressedImagePtr();
jpeg.length = static_cast<int>(jpeg_enc_obj_yuv420.getCompressedImageSize());
Expand All @@ -626,8 +618,6 @@ status_t JpegR::encodeJPEGR(uhdr_uncompressed_ptr yuv420_image_ptr, uhdr_uncompr
ULTRAHDR_CHECK(appendGainMap(&jpeg, &compressed_map, exif, /* icc */ nullptr, /* icc size */ 0,
metadata, dest));

printf("[dichenzhang] encodeJPEGR() api-x: pos 5\n");

return ULTRAHDR_NO_ERROR;
}

Expand Down Expand Up @@ -962,54 +952,38 @@ status_t JpegR::appendGainMap(uhdr_compressed_ptr primary_jpg_image_ptr,
uhdr_compressed_ptr gainmap_jpg_image_ptr, uhdr_exif_ptr pExif,
void* pIcc, size_t icc_size, ultrahdr_metadata_ptr metadata,
uhdr_compressed_ptr dest) {

printf("[dichenzhang] appendGainMap(): pos 1\n");


if (primary_jpg_image_ptr == nullptr || gainmap_jpg_image_ptr == nullptr || metadata == nullptr ||
dest == nullptr) {
return ERROR_ULTRAHDR_BAD_PTR;
}

printf("[dichenzhang] appendGainMap(): pos 2\n");

if (metadata->version.compare("1.0")) {
ALOGE("received bad value for version: %s", metadata->version.c_str());
return ERROR_ULTRAHDR_BAD_METADATA;
}

printf("[dichenzhang] appendGainMap(): pos 3\n");

if (metadata->maxContentBoost < metadata->minContentBoost) {
ALOGE("received bad value for content boost min %f, max %f", metadata->minContentBoost,
metadata->maxContentBoost);
return ERROR_ULTRAHDR_BAD_METADATA;
}

printf("[dichenzhang] appendGainMap(): pos 4\n");

if (metadata->hdrCapacityMax < metadata->hdrCapacityMin || metadata->hdrCapacityMin < 1.0f) {
ALOGE("received bad value for hdr capacity min %f, max %f", metadata->hdrCapacityMin,
metadata->hdrCapacityMax);
return ERROR_ULTRAHDR_BAD_METADATA;
}

printf("[dichenzhang] appendGainMap(): pos 5\n");

if (metadata->offsetSdr < 0.0f || metadata->offsetHdr < 0.0f) {
ALOGE("received bad value for offset sdr %f, hdr %f", metadata->offsetSdr, metadata->offsetHdr);
return ERROR_ULTRAHDR_BAD_METADATA;
}

printf("[dichenzhang] appendGainMap(): pos 6\n");

if (metadata->gamma <= 0.0f) {
ALOGE("received bad value for gamma %f", metadata->gamma);
return ERROR_ULTRAHDR_BAD_METADATA;
}

printf("[dichenzhang] appendGainMap(): pos 7\n");

const string nameSpace = "http://ns.adobe.com/xap/1.0/";
const int nameSpaceLength = nameSpace.size() + 1; // need to count the null terminator

Expand Down
14 changes: 8 additions & 6 deletions tests/editorhelper_test.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,8 @@

//#define DUMP_OUTPUT

#define MAX_BUFFER_SIZE 3840 * 2160 * 3 / 2

#ifdef DUMP_OUTPUT
static bool writeFile(const char* filename, void*& result, int length) {
std::ofstream ofd(filename, std::ios::binary);
Expand Down Expand Up @@ -513,8 +515,8 @@ TEST_F(EditorHelperTest, resizeGreyImageDown) {
}

TEST_F(EditorHelperTest, editingCombinationYuvImageWithNoEditing) {
jpegr_uncompressed_struct in_img;
jpegr_uncompressed_struct out_img;
ultrahdr_uncompressed_struct in_img;
ultrahdr_uncompressed_struct out_img;

in_img.data = mYuvImage.buffer.get();
in_img.width = IMAGE_WIDTH;
Expand All @@ -531,7 +533,7 @@ TEST_F(EditorHelperTest, editingCombinationYuvImageWithNoEditing) {
int out_height = IMAGE_HEIGHT;
int outSize = out_width * out_height * 3 / 2;

EXPECT_TRUE(addEffects(&in_img, effects, &out_img)== JPEGR_NO_ERROR);
EXPECT_TRUE(addEffects(&in_img, effects, &out_img)== ULTRAHDR_NO_ERROR);
EXPECT_TRUE(out_img.width = out_width);
EXPECT_TRUE(out_img.height = out_height);
EXPECT_TRUE(out_img.colorGamut == in_img.colorGamut);
Expand All @@ -545,8 +547,8 @@ TEST_F(EditorHelperTest, editingCombinationYuvImageWithNoEditing) {
}

TEST_F(EditorHelperTest, editingCombinationYuvImage) {
jpegr_uncompressed_struct in_img;
jpegr_uncompressed_struct out_img;
ultrahdr_uncompressed_struct in_img;
ultrahdr_uncompressed_struct out_img;

in_img.data = mYuvImage.buffer.get();
in_img.width = IMAGE_WIDTH;
Expand Down Expand Up @@ -582,7 +584,7 @@ TEST_F(EditorHelperTest, editingCombinationYuvImage) {
int out_height = cropEffect.bottom - cropEffect.top + 1;
int outSize = out_width * out_height * 3 / 2;

EXPECT_TRUE(addEffects(&in_img, effects, &out_img)== JPEGR_NO_ERROR);
EXPECT_TRUE(addEffects(&in_img, effects, &out_img)== ULTRAHDR_NO_ERROR);
EXPECT_TRUE(out_img.width = out_width);
EXPECT_TRUE(out_img.height = out_height);
EXPECT_TRUE(out_img.colorGamut == in_img.colorGamut);
Expand Down

0 comments on commit 7c04177

Please sign in to comment.