summaryrefslogtreecommitdiff
authorRico Yang <wei.yang@amlogic.com>2020-03-22 18:27:05 (GMT)
committer Zhi Zhou <zhi.zhou@amlogic.com>2020-05-12 03:07:31 (GMT)
commit4b6fbc611e32ca543c06177338854f516d833ff8 (patch)
tree23c273666dece25e3366ea5dd966de522de1f2f5
parenta98f33833f6d53a6098926b60357aec13fcf3ca9 (diff)
downloadmedia_modules-4b6fbc611e32ca543c06177338854f516d833ff8.zip
media_modules-4b6fbc611e32ca543c06177338854f516d833ff8.tar.gz
media_modules-4b6fbc611e32ca543c06177338854f516d833ff8.tar.bz2
amvenc_avc: add interface for setting color space [1/1]
PD#SWPL-22421 Problem: h264 encoder needs interface for setting color space Solution: add interface for setting color space Verify: verified on w400 and 905x3 Change-Id: If7ac9f3ed4a51378574273845733da2155853785 Signed-off-by: Rico Yang <wei.yang@amlogic.com>
Diffstat
-rw-r--r--drivers/frame_sink/encoder/h264/encoder.c10
-rw-r--r--drivers/frame_sink/encoder/h264/encoder.h1
2 files changed, 8 insertions, 3 deletions
diff --git a/drivers/frame_sink/encoder/h264/encoder.c b/drivers/frame_sink/encoder/h264/encoder.c
index 358866d..49a7088 100644
--- a/drivers/frame_sink/encoder/h264/encoder.c
+++ b/drivers/frame_sink/encoder/h264/encoder.c
@@ -1211,7 +1211,7 @@ static int scale_frame(struct encode_wq_s *wq,
GE2D_FORMAT_M24_NV21 | GE2D_LITTLE_ENDIAN;
if (wq->pic.encoder_width >= 1280 && wq->pic.encoder_height >= 720) {
- ge2d_config->dst_para.format |= GE2D_FORMAT_BT_STANDARD;
+ ge2d_config->dst_para.format |= wq->pic.color_space;
}
ge2d_config->dst_para.fill_color_en = 0;
@@ -2708,11 +2708,12 @@ static s32 convert_request(struct encode_wq_s *wq, u32 *cmd_info)
enc_pr(LOG_INFO, "wq->pic.encoder_height:%d, request fmt=%d\n",
wq->pic.encoder_height, wq->request.fmt);
- if (wq->pic.encoder_width >= 1280 && wq->pic.encoder_height >= 720 && wq->request.fmt == FMT_RGBA8888) {
+ if (wq->pic.encoder_width >= 1280 && wq->pic.encoder_height >= 720
+ && wq->request.fmt == FMT_RGBA8888 && wq->pic.color_space != GE2D_FORMAT_BT601) {
wq->request.scale_enable = 1;
wq->request.src_w = wq->pic.encoder_width;
wq->request.src_h = wq->pic.encoder_height;
- pr_err("hwenc: force wq->request.scale_enable=%d\n", wq->request.scale_enable);
+ enc_pr(LOG_DEBUG, "hwenc: force wq->request.scale_enable=%d\n", wq->request.scale_enable);
}
wq->request.nr_mode =
@@ -3266,6 +3267,9 @@ static long amvenc_avc_ioctl(struct file *file, u32 cmd, ulong arg)
pr_err("hwenc: AMVENC_AVC_IOC_CONFIG_INIT: w:%d, h:%d\n", wq->pic.encoder_width, wq->pic.encoder_height);
wq->pic.encoder_width = addr_info[2];
wq->pic.encoder_height = addr_info[3];
+
+ wq->pic.color_space = addr_info[4];
+ pr_err("hwenc: AMVENC_AVC_IOC_CONFIG_INIT, wq->pic.color_space=%#x\n", wq->pic.color_space);
if (wq->pic.encoder_width *
wq->pic.encoder_height >= 1280 * 720)
clock_level = 6;
diff --git a/drivers/frame_sink/encoder/h264/encoder.h b/drivers/frame_sink/encoder/h264/encoder.h
index 0008fb3..b5bbe7d 100644
--- a/drivers/frame_sink/encoder/h264/encoder.h
+++ b/drivers/frame_sink/encoder/h264/encoder.h
@@ -307,6 +307,7 @@ struct encode_picinfo_s {
u32 non_ref_limit;
u32 non_ref_cnt;
#endif
+ u32 color_space;
};
struct encode_cbr_s {