Closed hbiyik closed 5 months ago
@hbiyik
uncompact
is a technical detail and I'm not sure it's a good idea to leave it up to the user.
IMHO adding auto
is enough, either doing un-compact or not changing the bit depth.
diff --git a/libavfilter/vf_vpp_rkrga.c b/libavfilter/vf_vpp_rkrga.c
index 4b226f482c..ba34b67904 100644
--- a/libavfilter/vf_vpp_rkrga.c
+++ b/libavfilter/vf_vpp_rkrga.c
@@ -60,6 +60,7 @@ typedef struct RGAVppContext {
enum {
FORCE_YUV_DISABLE,
+ FORCE_YUV_AUTO,
FORCE_YUV_8BIT,
FORCE_YUV_10BIT,
FORCE_YUV_NB
@@ -291,8 +292,12 @@ static av_cold void config_force_format(AVFilterContext *ctx,
if (!out_format)
return;
- out_depth = (r->force_yuv == FORCE_YUV_8BIT) ? 8 :
- (r->force_yuv == FORCE_YUV_10BIT) ? 10 : 0;
+ if (r->force_yuv == FORCE_YUV_AUTO)
+ out_depth = (in_format == AV_PIX_FMT_NV15 ||
+ in_format == AV_PIX_FMT_NV20) ? 10 : 0;
+ else
+ out_depth = (r->force_yuv == FORCE_YUV_8BIT) ? 8 :
+ (r->force_yuv == FORCE_YUV_10BIT) ? 10 : 0;
if (!out_depth)
return;
@@ -441,6 +446,7 @@ static av_cold void rgavpp_uninit(AVFilterContext *ctx)
#define RKRGA_VPP_COMMON_OPTS \
{ "force_yuv", "Enforce planar YUV format output", OFFSET(force_yuv), AV_OPT_TYPE_INT, { .i64 = FORCE_YUV_DISABLE }, 0, FORCE_YUV_NB - 1, FLAGS, "force_yuv" }, \
{ "disable", NULL, 0, AV_OPT_TYPE_CONST, { .i64 = FORCE_YUV_DISABLE }, 0, 0, FLAGS, "force_yuv" }, \
+ { "auto", "Match in/out bit depth", 0, AV_OPT_TYPE_CONST, { .i64 = FORCE_YUV_AUTO }, 0, 0, FLAGS, "force_yuv" }, \
{ "8bit", "8-bit", 0, AV_OPT_TYPE_CONST, { .i64 = FORCE_YUV_8BIT }, 0, 0, FLAGS, "force_yuv" }, \
{ "10bit", "10-bit uncompact/8-bit", 0, AV_OPT_TYPE_CONST, { .i64 = FORCE_YUV_10BIT }, 0, 0, FLAGS, "force_yuv" }, \
{ "force_chroma", "Enforce chroma of planar YUV format output", OFFSET(force_chroma), AV_OPT_TYPE_INT, { .i64 = FORCE_CHROMA_AUTO }, 0, FORCE_CHROMA_NB - 1, FLAGS, "force_chroma" }, \
ok thats also fine.
Done in 28b4194
thanks for the fast response
10bit and 8bit force format options are working but missing, instead
force_yuv=uncompact
only converts to P0/210 when the input is NV15/20. Conversion for the rest of the formats are not necessary in normal decoder workflows since they will increase the bandwidth requirements.