From 1c480d0cd10a547baeda41a432de9e8814e79c56 Mon Sep 17 00:00:00 2001 From: Shaowei Xie <xie.shaowei@zte.com.cn> Date: Thu, 1 Aug 2024 09:24:41 +0000 Subject: [PATCH] Update 2 files - /AdaptiveFGS/film_grain_characteristics_example.cfg - /AdaptiveFGS/README_AdaptiveFGS.md --- AdaptiveFGS/README_AdaptiveFGS.md | 55 +++++++++++++++++++ .../film_grain_characteristics_example.cfg | 28 ++++++++++ 2 files changed, 83 insertions(+) create mode 100644 AdaptiveFGS/README_AdaptiveFGS.md create mode 100644 AdaptiveFGS/film_grain_characteristics_example.cfg diff --git a/AdaptiveFGS/README_AdaptiveFGS.md b/AdaptiveFGS/README_AdaptiveFGS.md new file mode 100644 index 000000000..f10085363 --- /dev/null +++ b/AdaptiveFGS/README_AdaptiveFGS.md @@ -0,0 +1,55 @@ +Reference software for implementation of adaptive film grain models in different regions +============================== + +This software package is used to produce showcases on the implementation of applying separate film grain models in different regions. The film grain model adaptation proposed in JVET-AH0166 was adopted into the VSEI TuC at the 34th meeting. + +In the showcase examples, two film grain models (i.e., Frequency filtering based method and Auto-regression based method) are applied simultaneously in two separate regions of each video. + +Test platform +================== + +While the VTM (VVC reference software) implementation of film grain currently only supports the Frequency filtering based method and not the Auto-regression based method, we implemented the Auto-regression model based on a third-party platform, i.e., SVT-AV1. Thus, the testing platform consists of the following two aspects. + +Frequency filtering film grain +---------------------------------------------- + +Frequency filtering film grain synthesis method in VTM (VTM-23.1 was used), where a configuration file is parsed to insert the film grain related SEI message into the bitstream, and the SEI message is parsed on the decoder side to carry out the film grain synthesis to output the resulted processed decoded video, corresponding to the normal FGC (Film Grain Characteristics) behavior. + +In this software package, an FGC configuration file example is provided, i.e., "film_grain_characteristics_example.cfg". + +The VTM source code is stored in a Git repository, and VTM-23.1 can be retrieved with the following link: https://vcgit.hhi.fraunhofer.de/jvet/VVCSoftware_VTM/-/tree/VTM-23.1?ref_type=tags + +The command line examples for encoding and decoding one video sequncen are shown below: + +```bash +EncoderApp -c lowdelayP.cfg -c sequence.cfg -c film_grain_characteristics_example.cfg -i input.yuv --QP=27 -b str.bin +DecoderApp -b str.bin -o dec.yuv --SEIFGSFilename=dec_model0FG.yuv +``` + +Auto-regression film grain +---------------------------------------------- + +Auto-regression film grain synthesis method in SVT-AV1 (SVT-AV1-v2.1.0 was used), where the film grain model parameters are estimated at the encoder side by considering the difference between the input picture and its denoised version, and the model parameters are included in the bitstream for the decoder to reproduce the film grain and add it in the reconstructed pictures. These steps are similar as to the normal FGC behavior, without parsing configuration file. The denoising of the input picture is performed using a Wiener filter. An Auto-regressive model driven by a unit variance Gaussian noise is used to model the film grain. + +In this test, to ensure the consistency of film grain sources as much as possible, the input video of SVT-AV1 is the output video with film grain through VTM-23.1. + +The SVT-AV1 source code is stored in a Git repository, and SVT-AV1-v2.1.0 can be retrieved with the following link: https://gitlab.com/AOMediaCodec/SVT-AV1/-/tree/v2.1.0?ref_type=tags + +The command line examples for encoding and decoding one video sequncen are shown below: + +```bash +SvtAv1EncApp -i input.yuv -w 1920 -h 1080 --input-depth 10 --fps 24 --crf 22 --preset 0 --film-grain 25 --film-grain-denoise 1 -b str.ivf +SvtAv1DecApp -i str.ivf -o dec_av1FG25.yuv +``` + +Splice different film grains in YUV domain +---------------------------------------------- + +Once achieving the two output videos (YUV420, 10bits) with separate film grain through VTM-23.1 and SVT-AV1 respectively, FFmpeg is used to merge them in YUV domain to reach the visual outcome of applying adaptive film grain models in different regions of the same video. + +The command line examples for cropping and splicing two videos are shown below: + +```bash +ffmpeg -s 1920x1080 -f rawvideo -pix_fmt yuv420p10le -i dec_model0FG.yuv -vf "crop=w=1312:h=848:x=480:y=64" -frames:v 600 dec_model0FG_crop.yuv +ffmpeg -s 1920x1080 -f rawvideo -pix_fmt yuv420p10le -i dec_av1FG25.yuv -s 1312x848 -f rawvideo -pix_fmt yuv420p10le -i dec_model0FG_crop.yuv -filter_complex "[0:v]overlay=x=480:y=64" -pix_fmt yuv420p10le output_spliceFG.yuv +``` diff --git a/AdaptiveFGS/film_grain_characteristics_example.cfg b/AdaptiveFGS/film_grain_characteristics_example.cfg new file mode 100644 index 000000000..c02b0d983 --- /dev/null +++ b/AdaptiveFGS/film_grain_characteristics_example.cfg @@ -0,0 +1,28 @@ +#======== Film grain characteristics SEI message ===================== +SEIFGCEnabled : 1 # enable to use FGC SEI message. +SEIFGCAnalysisEnabled : 0 # enable film grain analysis to estimate grain parameters. +SEIFGCCancelFlag : 0 # for SMPTE-RDD5: the value must be 0 +SEIFGCPersistenceFlag : 1 # for SMPTE-RDD5: the value must be 0; When FGC SEI frequency is once per I-period (SEIFGCPerPictureSEI is 0), than SEIFGCPersistenceFlag 1 +SEIFGCPerPictureSEI : 0 # for SMPTE-RDD5: the value must be 1 (0: FGC SEI is inserted once per I-period; 1: FGC SEI is inserted once per picture) +SEIFGCModelID : 0 # for SMPTE-RDD5: the value must be 0 (0: frequency filtering; 1: auto-regression; 2-3 are reserved) +SEIFGCSepColourDescPresentFlag : 0 # for SMPTE-RDD5: the value must be 0 (if not 0, need to specify separate colour description (not implemented in current encoder cmd line)) +SEIFGCBlendingModeID : 0 # for SMPTE-RDD5: the value must be 0 (0: additive; 1: multiplicative) +SEIFGCLog2ScaleFactor : 4 +SEIFGCCompModelPresentComp0 : 1 # if not 0, need to specify model for comp 0; otherwise default parameters will be used. +SEIFGCCompModelPresentComp1 : 1 # if not 0, need to specify model for comp 1; otherwise default parameters will be used. +SEIFGCCompModelPresentComp2 : 1 # if not 0, need to specify model for comp 2; otherwise default parameters will be used. +SEIFGCNumIntensityIntervalMinus1Comp0 : 7 # Number of intensity intervals minus 1 for comp 0 +SEIFGCNumIntensityIntervalMinus1Comp1 : 0 # Number of intensity intervals minus 1 for comp 1 +SEIFGCNumIntensityIntervalMinus1Comp2 : 0 # Number of intensity intervals minus 1 for comp 2 +SEIFGCNumModelValuesMinus1Comp0 : 1 # Number of model values minus 1 for comp 0 +SEIFGCNumModelValuesMinus1Comp1 : 0 # Number of model values minus 1 for comp 1 +SEIFGCNumModelValuesMinus1Comp2 : 0 # Number of model values minus 1 for comp 2 +SEIFGCIntensityIntervalLowerBoundComp0 : 0 40 60 80 100 120 140 160 # Lower bound of intensity interval for comp 0 (for SMPTE-RDD5, non-overlapping interval) +SEIFGCIntensityIntervalUpperBoundComp0 : 39 59 79 99 119 139 159 255 # Upper bound of intensity interval for comp 0 (for SMPTE-RDD5, non-overlapping interval) +SEIFGCIntensityIntervalLowerBoundComp1 : 0 # Lower bound of intensity interval for comp 1 (for SMPTE-RDD5, non-overlapping interval) +SEIFGCIntensityIntervalUpperBoundComp1 : 255 # Upper bound of intensity interval for comp 1 (for SMPTE-RDD5, non-overlapping interval) +SEIFGCIntensityIntervalLowerBoundComp2 : 0 # Lower bound of intensity interval for comp 2 (for SMPTE-RDD5, non-overlapping interval) +SEIFGCIntensityIntervalUpperBoundComp2 : 255 # Upper bound of intensity interval for comp 2 (for SMPTE-RDD5, non-overlapping interval) +SEIFGCCompModelValuesComp0 : 55 11 95 11 105 12 105 12 100 12 100 13 100 13 100 14 # model values for each intensity interval for comp 0 (sigma, h, v (h,v might be inferred based on number of model value)) +SEIFGCCompModelValuesComp1 : 150 # model values for each intensity interval for comp 1 (sigma, h, v (h,v might be inferred based on number of model value)) +SEIFGCCompModelValuesComp2 : 110 # model values for each intensity interval for comp 2 (sigma, h, v (h,v might be inferred based on number of model value)) -- GitLab