summaryrefslogtreecommitdiff
path: root/src/lib/dcp_video.cc
diff options
context:
space:
mode:
authorCarl Hetherington <cth@carlh.net>2015-08-24 16:43:38 +0100
committerCarl Hetherington <cth@carlh.net>2015-08-25 15:22:38 +0100
commita978f3ac575f1af017002c861480d5203cf0a34e (patch)
tree5cd7acdcf7b7f493f3d0047ba96adaccf8509a7e /src/lib/dcp_video.cc
parent17d4990d0fca0f38268441a73c73d9e340b4bc85 (diff)
Add video waveform viewer.
Diffstat (limited to 'src/lib/dcp_video.cc')
-rw-r--r--src/lib/dcp_video.cc24
1 files changed, 16 insertions, 8 deletions
diff --git a/src/lib/dcp_video.cc b/src/lib/dcp_video.cc
index f4c6222e2..e02bcffca 100644
--- a/src/lib/dcp_video.cc
+++ b/src/lib/dcp_video.cc
@@ -91,27 +91,35 @@ DCPVideo::DCPVideo (shared_ptr<const PlayerVideo> frame, shared_ptr<const cxml::
_resolution = Resolution (node->optional_number_child<int>("Resolution").get_value_or (RESOLUTION_2K));
}
-/** J2K-encode this frame on the local host.
- * @return Encoded data.
- */
-Data
-DCPVideo::encode_locally (dcp::NoteHandler note)
+shared_ptr<dcp::OpenJPEGImage>
+DCPVideo::convert_to_xyz (shared_ptr<const PlayerVideo> frame, dcp::NoteHandler note)
{
shared_ptr<dcp::OpenJPEGImage> xyz;
- shared_ptr<Image> image = _frame->image (AV_PIX_FMT_RGB48LE, note);
- if (_frame->colour_conversion()) {
+ shared_ptr<Image> image = frame->image (AV_PIX_FMT_RGB48LE, note);
+ if (frame->colour_conversion()) {
xyz = dcp::rgb_to_xyz (
image->data()[0],
image->size(),
image->stride()[0],
- _frame->colour_conversion().get(),
+ frame->colour_conversion().get(),
note
);
} else {
xyz = dcp::xyz_to_xyz (image->data()[0], image->size(), image->stride()[0]);
}
+ return xyz;
+}
+
+/** J2K-encode this frame on the local host.
+ * @return Encoded data.
+ */
+Data
+DCPVideo::encode_locally (dcp::NoteHandler note)
+{
+ shared_ptr<dcp::OpenJPEGImage> xyz = convert_to_xyz (_frame, note);
+
/* Set the max image and component sizes based on frame_rate */
int max_cs_len = ((float) _j2k_bandwidth) / 8 / _frames_per_second;
if (_frame->eyes() == EYES_LEFT || _frame->eyes() == EYES_RIGHT) {