summaryrefslogtreecommitdiff
path: root/libhwjpeg/ExynosJpegEncoderForCamera.cpp
diff options
context:
space:
mode:
authorCho KyongHo <pullip.cho@samsung.com>2019-08-14 11:35:01 +0900
committerCho KyongHo <pullip.cho@samsung.com>2020-02-20 21:34:34 -0800
commit6ef6bc8731a2319103d27912353eb814265152bc (patch)
treec0a7e12610b6948278ce7f79b55ffc4fbe1a99c3 /libhwjpeg/ExynosJpegEncoderForCamera.cpp
parent5046f8e2a5cc9ecf24bde419d82a1adbbb24127e (diff)
libhwjpeg: delegate driver init to each port
V4L2 API call sequence in LibScalerForJpeg is deviced by the APIs for both of the ports including output and capture: s_fmt(output) & s_fmt(capture) -> reqbufs(output) & reqbufs(capture) -> qbuf(output) & qbuf(capture) -> dqbuf(output) & dqbuf(capture). But LibScalerForJpeg should revert the success of an API call for output if the following the same API call for capture is failed for the next try. Now we can choose the better way: (s_fmt(output)->reqbufs(output))&(s_fmt(capture)->reqbufs(capture)) -> qbuf(output) & qbuf(capture) We do not need to revert an API call for output even though its following API call for capture.o We also moved parameters of LibScalerForJpeg::Set[Src|Dst]Image() about image buffers to LibScalerForJpeg::RunStream() because image dimension and format seldom change while buffers can be changed every frame. This change helps the better design. We do not need to hold the buffer information confirued by LibScalerForJpeg::Set[Src|Dst]Image() until LibScalerForJpeg::RunStream() is called. Change-Id: I4af0750975068b22055c1c2eafc53ce76d366479 Signed-off-by: Cho KyongHo <pullip.cho@samsung.com>
Diffstat (limited to 'libhwjpeg/ExynosJpegEncoderForCamera.cpp')
-rw-r--r--libhwjpeg/ExynosJpegEncoderForCamera.cpp26
1 files changed, 13 insertions, 13 deletions
diff --git a/libhwjpeg/ExynosJpegEncoderForCamera.cpp b/libhwjpeg/ExynosJpegEncoderForCamera.cpp
index 8d72eac..bb4dc2c 100644
--- a/libhwjpeg/ExynosJpegEncoderForCamera.cpp
+++ b/libhwjpeg/ExynosJpegEncoderForCamera.cpp
@@ -581,6 +581,17 @@ bool ExynosJpegEncoderForCamera::GenerateThumbnailImage()
ALOGD("Generating thumbnail image: %dx%d -> %dx%d",
main_width, main_height, m_nThumbWidth, m_nThumbHeight);
+ if (!m_pLibScaler.SetSrcImage(main_width, main_height, v4l2Format)) {
+ ALOGE("Failed to configure the main image format to LibScalerForJpeg");
+ return false;
+ }
+
+
+ if (!m_pLibScaler.SetDstImage(m_nThumbWidth, m_nThumbHeight, GetThumbnailFormat(v4l2Format))) {
+ ALOGE("Failed to configure the target image format to LibScalerForJpeg");
+ return false;
+ }
+
bool okay = false;
if (checkInBufType() == JPEG_BUF_TYPE_USER_PTR) {
@@ -592,7 +603,7 @@ bool ExynosJpegEncoderForCamera::GenerateThumbnailImage()
return false;
}
- okay = m_pLibScaler.SetSrcImage(main_width, main_height, v4l2Format, bufs);
+ okay = m_pLibScaler.RunStream(bufs, m_fdIONThumbImgBuffer);
} else { // mainbuftype == JPEG_BUF_TYPE_DMA_BUF
int bufs[3];
int len_srcbufs[3];
@@ -601,21 +612,10 @@ bool ExynosJpegEncoderForCamera::GenerateThumbnailImage()
ALOGE("Failed to retrieve the main image buffers");
return false;
}
- okay = m_pLibScaler.SetSrcImage(main_width, main_height, v4l2Format, bufs);
+ okay = m_pLibScaler.RunStream(bufs, m_fdIONThumbImgBuffer);
}
if (!okay) {
- ALOGE("Failed to configure the main image format to LibScalerForJpeg");
- return false;
- }
-
- if (!m_pLibScaler.SetDstImage(m_nThumbWidth, m_nThumbHeight,
- GetThumbnailFormat(v4l2Format), m_fdIONThumbImgBuffer)) {
- ALOGE("Failed to configure the target image format to LibScalerForJpeg");
- return false;
- }
-
- if (!m_pLibScaler.RunStream()) {
ALOGE("Failed to convert the main image to thumbnail with LibScalerForJpeg");
return false;
}