amvenc_avc: add interface for setting color space [1/1]
authorRico Yang <wei.yang@amlogic.com>
Sun, 22 Mar 2020 18:27:05 +0000 (02:27 +0800)
committerZhi Zhou <zhi.zhou@amlogic.com>
Tue, 12 May 2020 03:07:31 +0000 (20:07 -0700)
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>
drivers/frame_sink/encoder/h264/encoder.c
drivers/frame_sink/encoder/h264/encoder.h

index 358866dc35307c5ada3b8363dd6ca322c1d3fffb..49a70881f9b2be2994f089179fe486380112cf8b 100644 (file)
@@ -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;
index 0008fb3a8059da53238ea0736c5cb1c647a1ed6d..b5bbe7dc76638fb2df91346e9237139f68145f50 100644 (file)
@@ -307,6 +307,7 @@ struct encode_picinfo_s {
        u32 non_ref_limit;
        u32 non_ref_cnt;
 #endif
+       u32 color_space;
 };
 
 struct encode_cbr_s {