media_modules:vc1/vp9: provide aspect_ratio information by AMSTREAM_IOC_VDECSTAT

add ration_control information in vdec_status function for
	vc1/vp9, and normalized it for
	aspect_ratio in AMSTREAM_IOC_VDECSTAT message.
This commit is contained in:
afl1
2019-06-05 19:44:23 +02:00
committed by Dongjin Kim
parent d2cf4290e8
commit a0455f4223
2 changed files with 19 additions and 0 deletions

View File

@@ -170,6 +170,10 @@ enum {
RATE_MEASURE_END_PTS,
RATE_MEASURE_DONE
};
struct VC1Decoder_s {
u32 ratio_control;
};
#define RATE_MEASURE_NUM 8
#define RATE_CORRECTION_THRESHOLD 5
#define RATE_24_FPS 3755 /* 23.97 */
@@ -756,6 +760,9 @@ static int vvc1_event_cb(int type, void *data, void *private_data)
int vvc1_dec_status(struct vdec_s *vdec, struct vdec_info *vstatus)
{
struct VC1Decoder_s *vc1 =
(struct VC1Decoder_s *)vdec->private;
if (!(stat & STAT_VDEC_RUN))
return -1;
@@ -780,6 +787,7 @@ int vvc1_dec_status(struct vdec_s *vdec, struct vdec_info *vstatus)
snprintf(vstatus->vdec_name, sizeof(vstatus->vdec_name),
"%s", DRIVER_NAME);
vstatus->ratio_control = vc1->ratio_control;
return 0;
}
@@ -1174,12 +1182,20 @@ static s32 vvc1_init(void)
static int amvdec_vc1_probe(struct platform_device *pdev)
{
struct vdec_s *pdata = *(struct vdec_s **)pdev->dev.platform_data;
struct VC1Decoder_s *pbi;
if (pdata == NULL) {
pr_info("amvdec_vc1 memory resource undefined.\n");
return -EFAULT;
}
pbi = vmalloc(sizeof(struct VC1Decoder_s));
if (pbi == NULL) {
pr_info("\namvdec_vc1 device data allocation failed\n");
return -ENOMEM;
}
pdata->private = pbi;
if (pdata->sys_info) {
vvc1_amstream_dec_info = *pdata->sys_info;

View File

@@ -1111,6 +1111,7 @@ struct VP9Decoder_s {
struct firmware_s *fw;
int max_pic_w;
int max_pic_h;
u32 ratio_control;
#ifdef SUPPORT_FB_DECODING
int dec_s1_result;
int s1_test_cmd;
@@ -6417,6 +6418,7 @@ static void set_frame_info(struct VP9Decoder_s *pbi, struct vframe_s *vf)
ar = min_t(u32, pbi->frame_ar, DISP_RATIO_ASPECT_RATIO_MAX);
vf->ratio_control = (ar << DISP_RATIO_ASPECT_RATIO_BIT);
pbi->ratio_control = vf->ratio_control;
}
@@ -7827,6 +7829,7 @@ int vvp9_dec_status(struct vdec_s *vdec, struct vdec_info *vstatus)
snprintf(vstatus->vdec_name, sizeof(vstatus->vdec_name),
"%s", DRIVER_NAME);
#endif
vstatus->ratio_control = vp9->ratio_control;
return 0;
}