media: coda: add decoder MPEG-2 profile and level controls
The MPEG-2 decoder firmware reports profile and level indication that can be used to set V4L2 MPEG-2 profile and level controls Signed-off-by: Philipp Zabel <p.zabel@pengutronix.de> Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl> Signed-off-by: Mauro Carvalho Chehab <mchehab+samsung@kernel.org>
This commit is contained in:

committed by
Mauro Carvalho Chehab

parent
5902bca94a
commit
8a8621ba01
44
drivers/media/platform/coda/coda-mpeg2.c
Normal file
44
drivers/media/platform/coda/coda-mpeg2.c
Normal file
@@ -0,0 +1,44 @@
|
||||
// SPDX-License-Identifier: GPL-2.0-or-later
|
||||
/*
|
||||
* Coda multi-standard codec IP - MPEG-2 helper functions
|
||||
*
|
||||
* Copyright (C) 2019 Pengutronix, Philipp Zabel
|
||||
*/
|
||||
|
||||
#include <linux/kernel.h>
|
||||
#include <linux/videodev2.h>
|
||||
#include "coda.h"
|
||||
|
||||
int coda_mpeg2_profile(int profile_idc)
|
||||
{
|
||||
switch (profile_idc) {
|
||||
case 5:
|
||||
return V4L2_MPEG_VIDEO_MPEG2_PROFILE_SIMPLE;
|
||||
case 4:
|
||||
return V4L2_MPEG_VIDEO_MPEG2_PROFILE_MAIN;
|
||||
case 3:
|
||||
return V4L2_MPEG_VIDEO_MPEG2_PROFILE_SNR_SCALABLE;
|
||||
case 2:
|
||||
return V4L2_MPEG_VIDEO_MPEG2_PROFILE_SPATIALLY_SCALABLE;
|
||||
case 1:
|
||||
return V4L2_MPEG_VIDEO_MPEG2_PROFILE_HIGH;
|
||||
default:
|
||||
return -EINVAL;
|
||||
}
|
||||
}
|
||||
|
||||
int coda_mpeg2_level(int level_idc)
|
||||
{
|
||||
switch (level_idc) {
|
||||
case 10:
|
||||
return V4L2_MPEG_VIDEO_MPEG2_LEVEL_LOW;
|
||||
case 8:
|
||||
return V4L2_MPEG_VIDEO_MPEG2_LEVEL_MAIN;
|
||||
case 6:
|
||||
return V4L2_MPEG_VIDEO_MPEG2_LEVEL_HIGH_1440;
|
||||
case 4:
|
||||
return V4L2_MPEG_VIDEO_MPEG2_LEVEL_HIGH;
|
||||
default:
|
||||
return -EINVAL;
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user