summaryrefslogtreecommitdiff
path: root/test/image_test.cc
diff options
context:
space:
mode:
authorCarl Hetherington <cth@carlh.net>2021-12-18 23:34:26 +0100
committerCarl Hetherington <cth@carlh.net>2022-04-29 00:27:17 +0200
commit59c4edb69ba926d3790198cd2b62dc601944a632 (patch)
tree5f209c2aa5cbf60ec194bc1ab25ea63c75c4e854 /test/image_test.cc
parent7ec6c86c913fba820870565ee757fdf43ae47433 (diff)
Add image_as_jpeg()
Diffstat (limited to 'test/image_test.cc')
-rw-r--r--test/image_test.cc14
1 files changed, 14 insertions, 0 deletions
diff --git a/test/image_test.cc b/test/image_test.cc
index 18d96d4fc..8d934bdd6 100644
--- a/test/image_test.cc
+++ b/test/image_test.cc
@@ -30,6 +30,7 @@
#include "lib/image.h"
#include "lib/image_content.h"
#include "lib/image_decoder.h"
+#include "lib/image_jpeg.h"
#include "lib/image_png.h"
#include "lib/ffmpeg_image_proxy.h"
#include "test.h"
@@ -384,6 +385,19 @@ BOOST_AUTO_TEST_CASE (as_png_test)
}
+BOOST_AUTO_TEST_CASE (as_jpeg_test)
+{
+ auto proxy = make_shared<FFmpegImageProxy>("test/data/3d_test/000001.png");
+ auto image_rgb = proxy->image(Image::Alignment::PADDED).image;
+ auto image_bgr = image_rgb->convert_pixel_format(dcp::YUVToRGB::REC709, AV_PIX_FMT_BGRA, Image::Alignment::PADDED, false);
+ image_as_jpeg(image_rgb, 60).write("build/test/as_jpeg_rgb.jpeg");
+ image_as_jpeg(image_bgr, 60).write("build/test/as_jpeg_bgr.jpeg");
+
+ check_image ("test/data/as_jpeg_rgb.jpeg", "build/test/as_jpeg_rgb.jpeg");
+ check_image ("test/data/as_jpeg_bgr.jpeg", "build/test/as_jpeg_bgr.jpeg");
+}
+
+
/* Very dumb test to fade black to make sure it stays black */
static void
fade_test_format_black (AVPixelFormat f, string name)