├── .dockerignore ├── .gitattributes ├── .github ├── dependabot.yml └── workflows │ ├── docker.yml │ ├── ffmpeg.yml │ ├── libvmaf.yml │ └── windows.yml ├── .gitignore ├── .travis.yml ├── CHANGELOG.md ├── CONTRIBUTING.md ├── Dockerfile ├── Dockerfile.cuda ├── LICENSE ├── Makefile ├── OSSMETADATA ├── README.md ├── libvmaf ├── README.md ├── doc │ ├── Doxyfile.in │ └── meson.build ├── include │ ├── libvmaf │ │ ├── feature.h │ │ ├── libvmaf.h │ │ ├── libvmaf_cuda.h │ │ ├── meson.build │ │ ├── model.h │ │ ├── picture.h │ │ └── version.h.in │ ├── meson.build │ └── vcs_version.h.in ├── meson.build ├── meson_options.txt ├── src │ ├── arm │ │ ├── cpu.c │ │ └── cpu.h │ ├── compat │ │ ├── gcc │ │ │ └── stdatomic.h │ │ └── msvc │ │ │ └── stdatomic.h │ ├── cpu.c │ ├── cpu.h │ ├── cuda │ │ ├── common.c │ │ ├── common.h │ │ ├── cuda_helper.cuh │ │ ├── picture_cuda.c │ │ ├── picture_cuda.h │ │ ├── ring_buffer.c │ │ └── ring_buffer.h │ ├── dict.c │ ├── dict.h │ ├── ext │ │ └── x86 │ │ │ └── x86inc.asm │ ├── feature │ │ ├── adm.c │ │ ├── adm.h │ │ ├── adm_options.h │ │ ├── adm_tools.c │ │ ├── adm_tools.h │ │ ├── alias.c │ │ ├── alias.h │ │ ├── all.c │ │ ├── ansnr.c │ │ ├── ansnr.h │ │ ├── ansnr_options.h │ │ ├── ansnr_tools.c │ │ ├── ansnr_tools.h │ │ ├── arm64 │ │ │ ├── adm_neon.c │ │ │ ├── adm_neon.h │ │ │ ├── vif_neon.c │ │ │ └── vif_neon.h │ │ ├── cambi.c │ │ ├── ciede.c │ │ ├── common │ │ │ ├── alignment.c │ │ │ ├── alignment.h │ │ │ ├── blur_array.c │ │ │ ├── blur_array.h │ │ │ ├── convolution.c │ │ │ ├── convolution.h │ │ │ ├── convolution_avx.c │ │ │ ├── convolution_internal.h │ │ │ └── macros.h │ │ ├── cuda │ │ │ ├── integer_adm │ │ │ │ ├── adm_cm.cu │ │ │ │ ├── adm_csf.cu │ │ │ │ ├── adm_csf_den.cu │ │ │ │ ├── adm_decouple.cu │ │ │ │ └── adm_dwt2.cu │ │ │ ├── integer_adm_cuda.c │ │ │ ├── integer_adm_cuda.h │ │ │ ├── integer_motion │ │ │ │ └── motion_score.cu │ │ │ ├── integer_motion_cuda.c │ │ │ ├── integer_motion_cuda.h │ │ │ ├── integer_vif │ │ │ │ ├── filter1d.cu │ │ │ │ └── vif_statistics.cuh │ │ │ ├── integer_vif_cuda.c │ │ │ └── integer_vif_cuda.h │ │ ├── feature_collector.c │ │ ├── feature_collector.h │ │ ├── feature_extractor.c │ │ ├── feature_extractor.h │ │ ├── feature_name.c │ │ ├── feature_name.h │ │ ├── float_adm.c │ │ ├── float_ansnr.c │ │ ├── float_moment.c │ │ ├── float_motion.c │ │ ├── float_ms_ssim.c │ │ ├── float_psnr.c │ │ ├── float_ssim.c │ │ ├── float_vif.c │ │ ├── integer_adm.c │ │ ├── integer_adm.h │ │ ├── integer_motion.c │ │ ├── integer_motion.h │ │ ├── integer_psnr.c │ │ ├── integer_ssim.c │ │ ├── integer_vif.c │ │ ├── integer_vif.h │ │ ├── iqa │ │ │ ├── convolve.c │ │ │ ├── convolve.h │ │ │ ├── decimate.c │ │ │ ├── decimate.h │ │ │ ├── iqa.h │ │ │ ├── iqa_options.h │ │ │ ├── iqa_os.h │ │ │ ├── math_utils.c │ │ │ ├── math_utils.h │ │ │ ├── ssim_tools.c │ │ │ └── ssim_tools.h │ │ ├── luminance_tools.c │ │ ├── luminance_tools.h │ │ ├── mkdirp.c │ │ ├── mkdirp.h │ │ ├── moment.c │ │ ├── moment.h │ │ ├── moment_options.h │ │ ├── motion.c │ │ ├── motion.h │ │ ├── motion_options.h │ │ ├── motion_tools.h │ │ ├── ms_ssim.c │ │ ├── ms_ssim.h │ │ ├── null.c │ │ ├── offset.c │ │ ├── offset.h │ │ ├── picture_copy.c │ │ ├── picture_copy.h │ │ ├── psnr.c │ │ ├── psnr.h │ │ ├── psnr_options.h │ │ ├── psnr_tools.c │ │ ├── psnr_tools.h │ │ ├── ssim.c │ │ ├── ssim.h │ │ ├── third_party │ │ │ └── xiph │ │ │ │ └── psnr_hvs.c │ │ ├── vif.c │ │ ├── vif.h │ │ ├── vif_options.h │ │ ├── vif_tools.c │ │ ├── vif_tools.h │ │ └── x86 │ │ │ ├── adm_avx2.c │ │ │ ├── adm_avx2.h │ │ │ ├── cambi_avx2.c │ │ │ ├── cambi_avx2.h │ │ │ ├── motion_avx2.c │ │ │ ├── motion_avx2.h │ │ │ ├── motion_avx512.c │ │ │ ├── motion_avx512.h │ │ │ ├── vif_avx2.c │ │ │ ├── vif_avx2.h │ │ │ ├── vif_avx512.c │ │ │ └── vif_avx512.h │ ├── fex_ctx_vector.c │ ├── fex_ctx_vector.h │ ├── framesync.c │ ├── framesync.h │ ├── libvmaf.c │ ├── log.c │ ├── log.h │ ├── mem.c │ ├── mem.h │ ├── meson.build │ ├── metadata_handler.c │ ├── metadata_handler.h │ ├── model.c │ ├── model.h │ ├── opt.c │ ├── opt.h │ ├── output.c │ ├── output.h │ ├── pdjson.c │ ├── pdjson.h │ ├── picture.c │ ├── picture.h │ ├── predict.c │ ├── predict.h │ ├── read_json_model.c │ ├── read_json_model.h │ ├── ref.c │ ├── ref.h │ ├── svm.cpp │ ├── svm.h │ ├── thread_pool.c │ ├── thread_pool.h │ └── x86 │ │ ├── cpu.c │ │ ├── cpu.h │ │ └── cpuid.asm ├── test │ ├── meson.build │ ├── test.c │ ├── test.h │ ├── test_cambi.c │ ├── test_ciede.c │ ├── test_cli_parse.c │ ├── test_context.c │ ├── test_cpu.c │ ├── test_cuda_pic_preallocation.c │ ├── test_dict.c │ ├── test_feature.c │ ├── test_feature_collector.c │ ├── test_feature_extractor.c │ ├── test_framesync.c │ ├── test_log.c │ ├── test_luminance_tools.c │ ├── test_model.c │ ├── test_picture.c │ ├── test_predict.c │ ├── test_propagate_metadata.c │ ├── test_psnr.c │ ├── test_ref.c │ ├── test_ring_buffer.c │ └── test_thread_pool.c └── tools │ ├── README.md │ ├── cli_parse.c │ ├── cli_parse.h │ ├── meson.build │ ├── spinner.h │ ├── test │ ├── meson.build │ └── test_vmaf_cuda_gpumask.sh │ ├── vidinput.c │ ├── vidinput.h │ ├── vmaf.c │ ├── y4m_input.c │ └── yuv_input.c ├── matlab ├── .gitignore ├── STMAD_2011_MatlabCode │ ├── Example.m │ ├── MotionWeight.m │ ├── STMAD_index.m │ ├── calcSMADScore.m │ ├── calcSTMADScore.m │ ├── calculateSMADScore.m │ ├── hi_index.m │ ├── ical_stat.c │ ├── ical_stat.mexa64 │ ├── ical_stat.mexmaci64 │ ├── ical_stat.mexw64 │ ├── ical_std.c │ ├── ical_std.mexa64 │ ├── ical_std.mexmaci64 │ ├── ical_std.mexw64 │ ├── lo_index.m │ ├── readframefromfid.m │ ├── run_smad.m │ ├── run_stmad.m │ └── yuvread.m ├── SpEED │ ├── SpEED │ │ ├── Single_Scale_Video_SPEED.m │ │ ├── calcSpEEDScore.m │ │ ├── est_params.m │ │ └── readframefromfid_all_fmts.m │ └── run_speed.m ├── cid_icid │ ├── BT709_f.mat │ ├── BT709_l.mat │ ├── iCID │ │ └── iCID_Metric │ │ │ ├── ColorSpaceTransformations │ │ │ ├── FilterImageCSF.m │ │ │ ├── ImageSRGB2XYZ.m │ │ │ ├── ImageXYZ2LAB2000HL.m │ │ │ ├── LAB2000HL.mat │ │ │ ├── LAB2LAB2000HL.m │ │ │ ├── SRGB2XYZ.m │ │ │ ├── XYZ2LAB.m │ │ │ └── colorspace.m │ │ │ ├── README.txt │ │ │ └── iCID.m │ ├── run_icid.m │ ├── yuv2rgb.m │ └── yuvread.m └── strred │ ├── README │ ├── SR_SIM.m │ ├── matlabPyrTools │ ├── ChangeLog │ ├── Contents.m │ ├── MEX │ │ ├── -MacReadMe │ │ ├── .AppleDouble │ │ │ └── .Parent │ │ ├── .FBCIndex │ │ ├── .FBCLockFolder │ │ │ └── .FBCSemaphoreFile │ │ ├── Copy_of_corrDn.mexmac │ │ ├── Makefile-linux │ │ ├── Makefile-ml6-linux │ │ ├── Makefile-osx │ │ ├── Makefile-solaris │ │ ├── Makefile-sun4 │ │ ├── convolve.c │ │ ├── convolve.h │ │ ├── corrDn.c │ │ ├── corrDn.dll │ │ ├── corrDn.exp │ │ ├── corrDn.lib │ │ ├── corrDn.mex │ │ ├── corrDn.mex4 │ │ ├── corrDn.mexa64 │ │ ├── corrDn.mexglx │ │ ├── corrDn.mexlx │ │ ├── corrDn.mexmac │ │ ├── corrDn.mexsol │ │ ├── corrDn.mexw32 │ │ ├── edges-orig.c │ │ ├── edges.c │ │ ├── histo.c │ │ ├── histo.dll │ │ ├── histo.mex │ │ ├── histo.mex4 │ │ ├── histo.mexglx │ │ ├── histo.mexlx │ │ ├── histo.mexmac │ │ ├── histo.mexsol │ │ ├── innerProd.c │ │ ├── innerProd.dll │ │ ├── innerProd.mexglx │ │ ├── innerProd.mexlx │ │ ├── innerProd.mexmac │ │ ├── innerProd.mexsol │ │ ├── pointOp.c │ │ ├── pointOp.dll │ │ ├── pointOp.mex │ │ ├── pointOp.mex4 │ │ ├── pointOp.mexglx │ │ ├── pointOp.mexlx │ │ ├── pointOp.mexmac │ │ ├── pointOp.mexsol │ │ ├── pointOp.o │ │ ├── range2.c │ │ ├── range2.dll │ │ ├── range2.mex │ │ ├── range2.mex4 │ │ ├── range2.mexglx │ │ ├── range2.mexlx │ │ ├── range2.mexmac │ │ ├── range2.mexsol │ │ ├── range2.o │ │ ├── upConv.c │ │ ├── upConv.dll │ │ ├── upConv.mex │ │ ├── upConv.mex4 │ │ ├── upConv.mexglx │ │ ├── upConv.mexlx │ │ ├── upConv.mexmac │ │ ├── upConv.mexsol │ │ ├── upConv.o │ │ └── wrap.c │ ├── README │ ├── TUTORIALS │ │ ├── README │ │ ├── matlabPyrTools.m │ │ └── pyramids.m │ ├── binomialFilter.m │ ├── blur.m │ ├── blurDn.m │ ├── buildGpyr.m │ ├── buildLpyr.m │ ├── buildSCFpyr.m │ ├── buildSCFpyrLevs.m │ ├── buildSFpyr.m │ ├── buildSFpyrLevs.m │ ├── buildSpyr.m │ ├── buildSpyrLevs.m │ ├── buildWpyr.m │ ├── cconv2.m │ ├── clip.m │ ├── corrDn.m │ ├── einstein.pgm │ ├── entropy2.m │ ├── factorial.m │ ├── feynman.pgm │ ├── histo.m │ ├── histoMatch.m │ ├── ifftshift.m │ ├── imGradient.m │ ├── imStats.m │ ├── innerProd.m │ ├── kurt2.m │ ├── lplot.m │ ├── lpyrHt.m │ ├── maxPyrHt.m │ ├── mean2.m │ ├── mkAngle.m │ ├── mkAngularSine.m │ ├── mkDisc.m │ ├── mkFract.m │ ├── mkGaussian.m │ ├── mkImpulse.m │ ├── mkR.m │ ├── mkRamp.m │ ├── mkSine.m │ ├── mkSquare.m │ ├── mkZonePlate.m │ ├── mod1.m │ ├── model_pyr.m │ ├── modulateFlip.m │ ├── namedFilter.m │ ├── nextFig.m │ ├── pgmRead.m │ ├── pgmWrite.m │ ├── pixelAxes.m │ ├── pointOp.m │ ├── pwd2path.m │ ├── pyrBand.m │ ├── pyrBandIndices.m │ ├── pyrLow.m │ ├── range2.m │ ├── rconv2.m │ ├── rcosFn.m │ ├── reconLpyr.m │ ├── reconSCFpyr.m │ ├── reconSFpyr.m │ ├── reconSFpyrLevs.m │ ├── reconSpyr.m │ ├── reconSpyrLevs.m │ ├── reconWpyr.m │ ├── setPyrBand.m │ ├── shift.m │ ├── showIm.m │ ├── showLpyr.m │ ├── showSpyr.m │ ├── showWpyr.m │ ├── simulate.m │ ├── skew2.m │ ├── sp0Filters.m │ ├── sp1Filters.m │ ├── sp3Filters.m │ ├── sp5Filters.m │ ├── spyrBand.m │ ├── spyrHigh.m │ ├── spyrHt.m │ ├── spyrLev.m │ ├── spyrNumBands.m │ ├── steer.m │ ├── steer2HarmMtx.m │ ├── subMtx.m │ ├── upBlur.m │ ├── upConv.m │ ├── var2.m │ ├── vectify.m │ ├── wpyrBand.m │ ├── wpyrHt.m │ ├── wpyrLev.m │ └── zconv2.m │ ├── run_strred.m │ ├── run_strred_opt.m │ ├── strred │ ├── buildSpyr_single.m │ ├── calcStrredScore.m │ ├── calcStrredScore_opt.m │ ├── est_params.m │ ├── extract_info.m │ ├── extract_info_opt.m │ ├── ind2wtree.m │ ├── readframefromfid.m │ └── rred2dmos.m │ └── workspace │ └── .gitignore ├── model ├── other_models │ ├── model_V8a.model │ ├── nflx_v1.json │ ├── nflx_v1.pkl │ ├── nflx_v1.pkl.model │ ├── nflx_vmaff_rf_v1.pkl │ ├── nflx_vmaff_rf_v2.pkl │ ├── nflxall_libsvmnusvr_currentbest.pkl │ ├── nflxall_libsvmnusvr_currentbest.pkl.model │ ├── nflxall_vmafv1.pkl │ ├── nflxall_vmafv1.pkl.model │ ├── nflxall_vmafv2.pkl │ ├── nflxall_vmafv2.pkl.model │ ├── nflxall_vmafv3.pkl │ ├── nflxall_vmafv3.pkl.model │ ├── nflxall_vmafv3a.pkl │ ├── nflxall_vmafv3a.pkl.model │ ├── nflxall_vmafv4.pkl │ ├── nflxall_vmafv4.pkl.model │ ├── nflxtrain_libsvmnusvr_currentbest.pkl │ ├── nflxtrain_libsvmnusvr_currentbest.pkl.model │ ├── nflxtrain_norm_type_none.json │ ├── nflxtrain_norm_type_none.pkl │ ├── nflxtrain_norm_type_none.pkl.model │ ├── nflxtrain_vmafv1.pkl │ ├── nflxtrain_vmafv1.pkl.model │ ├── nflxtrain_vmafv2.pkl │ ├── nflxtrain_vmafv2.pkl.model │ ├── nflxtrain_vmafv3.pkl │ ├── nflxtrain_vmafv3.pkl.model │ ├── nflxtrain_vmafv3a.pkl │ ├── nflxtrain_vmafv3a.pkl.model │ ├── niqe_v0.1.pkl │ ├── vmaf_4k_v0.6.1rc.pkl │ ├── vmaf_4k_v0.6.1rc.pkl.model │ ├── vmaf_v0.6.0.json │ ├── vmaf_v0.6.0.pkl │ ├── vmaf_v0.6.0.pkl.model │ └── vmaf_v0.6.1mfz.json ├── vmaf_4k_rb_v0.6.2 │ ├── vmaf_4k_rb_v0.6.2.json │ ├── vmaf_4k_rb_v0.6.2.pkl │ ├── vmaf_4k_rb_v0.6.2.pkl.0001 │ ├── vmaf_4k_rb_v0.6.2.pkl.0001.model │ ├── vmaf_4k_rb_v0.6.2.pkl.0002 │ ├── vmaf_4k_rb_v0.6.2.pkl.0002.model │ ├── vmaf_4k_rb_v0.6.2.pkl.0003 │ ├── vmaf_4k_rb_v0.6.2.pkl.0003.model │ ├── vmaf_4k_rb_v0.6.2.pkl.0004 │ ├── vmaf_4k_rb_v0.6.2.pkl.0004.model │ ├── vmaf_4k_rb_v0.6.2.pkl.0005 │ ├── vmaf_4k_rb_v0.6.2.pkl.0005.model │ ├── vmaf_4k_rb_v0.6.2.pkl.0006 │ ├── vmaf_4k_rb_v0.6.2.pkl.0006.model │ ├── vmaf_4k_rb_v0.6.2.pkl.0007 │ ├── vmaf_4k_rb_v0.6.2.pkl.0007.model │ ├── vmaf_4k_rb_v0.6.2.pkl.0008 │ ├── vmaf_4k_rb_v0.6.2.pkl.0008.model │ ├── vmaf_4k_rb_v0.6.2.pkl.0009 │ ├── vmaf_4k_rb_v0.6.2.pkl.0009.model │ ├── vmaf_4k_rb_v0.6.2.pkl.0010 │ ├── vmaf_4k_rb_v0.6.2.pkl.0010.model │ ├── vmaf_4k_rb_v0.6.2.pkl.0011 │ ├── vmaf_4k_rb_v0.6.2.pkl.0011.model │ ├── vmaf_4k_rb_v0.6.2.pkl.0012 │ ├── vmaf_4k_rb_v0.6.2.pkl.0012.model │ ├── vmaf_4k_rb_v0.6.2.pkl.0013 │ ├── vmaf_4k_rb_v0.6.2.pkl.0013.model │ ├── vmaf_4k_rb_v0.6.2.pkl.0014 │ ├── vmaf_4k_rb_v0.6.2.pkl.0014.model │ ├── vmaf_4k_rb_v0.6.2.pkl.0015 │ ├── vmaf_4k_rb_v0.6.2.pkl.0015.model │ ├── vmaf_4k_rb_v0.6.2.pkl.0016 │ ├── vmaf_4k_rb_v0.6.2.pkl.0016.model │ ├── vmaf_4k_rb_v0.6.2.pkl.0017 │ ├── vmaf_4k_rb_v0.6.2.pkl.0017.model │ ├── vmaf_4k_rb_v0.6.2.pkl.0018 │ ├── vmaf_4k_rb_v0.6.2.pkl.0018.model │ ├── vmaf_4k_rb_v0.6.2.pkl.0019 │ ├── vmaf_4k_rb_v0.6.2.pkl.0019.model │ └── vmaf_4k_rb_v0.6.2.pkl.model ├── vmaf_4k_v0.6.1.json ├── vmaf_4k_v0.6.1neg.json ├── vmaf_b_v0.6.3.json ├── vmaf_float_4k_v0.6.1.json ├── vmaf_float_b_v0.6.3.json ├── vmaf_float_b_v0.6.3 │ ├── vmaf_float_b_v0.6.3.json │ ├── vmaf_float_b_v0.6.3.pkl │ ├── vmaf_float_b_v0.6.3.pkl.0001 │ ├── vmaf_float_b_v0.6.3.pkl.0001.model │ ├── vmaf_float_b_v0.6.3.pkl.0002 │ ├── vmaf_float_b_v0.6.3.pkl.0002.model │ ├── vmaf_float_b_v0.6.3.pkl.0003 │ ├── vmaf_float_b_v0.6.3.pkl.0003.model │ ├── vmaf_float_b_v0.6.3.pkl.0004 │ ├── vmaf_float_b_v0.6.3.pkl.0004.model │ ├── vmaf_float_b_v0.6.3.pkl.0005 │ ├── vmaf_float_b_v0.6.3.pkl.0005.model │ ├── vmaf_float_b_v0.6.3.pkl.0006 │ ├── vmaf_float_b_v0.6.3.pkl.0006.model │ ├── vmaf_float_b_v0.6.3.pkl.0007 │ ├── vmaf_float_b_v0.6.3.pkl.0007.model │ ├── vmaf_float_b_v0.6.3.pkl.0008 │ ├── vmaf_float_b_v0.6.3.pkl.0008.model │ ├── vmaf_float_b_v0.6.3.pkl.0009 │ ├── vmaf_float_b_v0.6.3.pkl.0009.model │ ├── vmaf_float_b_v0.6.3.pkl.0010 │ ├── vmaf_float_b_v0.6.3.pkl.0010.model │ ├── vmaf_float_b_v0.6.3.pkl.0011 │ ├── vmaf_float_b_v0.6.3.pkl.0011.model │ ├── vmaf_float_b_v0.6.3.pkl.0012 │ ├── vmaf_float_b_v0.6.3.pkl.0012.model │ ├── vmaf_float_b_v0.6.3.pkl.0013 │ ├── vmaf_float_b_v0.6.3.pkl.0013.model │ ├── vmaf_float_b_v0.6.3.pkl.0014 │ ├── vmaf_float_b_v0.6.3.pkl.0014.model │ ├── vmaf_float_b_v0.6.3.pkl.0015 │ ├── vmaf_float_b_v0.6.3.pkl.0015.model │ ├── vmaf_float_b_v0.6.3.pkl.0016 │ ├── vmaf_float_b_v0.6.3.pkl.0016.model │ ├── vmaf_float_b_v0.6.3.pkl.0017 │ ├── vmaf_float_b_v0.6.3.pkl.0017.model │ ├── vmaf_float_b_v0.6.3.pkl.0018 │ ├── vmaf_float_b_v0.6.3.pkl.0018.model │ ├── vmaf_float_b_v0.6.3.pkl.0019 │ ├── vmaf_float_b_v0.6.3.pkl.0019.model │ ├── vmaf_float_b_v0.6.3.pkl.0020 │ ├── vmaf_float_b_v0.6.3.pkl.0020.model │ └── vmaf_float_b_v0.6.3.pkl.model ├── vmaf_float_v0.6.1.json ├── vmaf_float_v0.6.1.pkl ├── vmaf_float_v0.6.1.pkl.model ├── vmaf_float_v0.6.1neg.json ├── vmaf_float_v0.6.1neg.pkl ├── vmaf_float_v0.6.1neg.pkl.model ├── vmaf_rb_v0.6.2 │ ├── vmaf_rb_v0.6.2.json │ ├── vmaf_rb_v0.6.2.pkl │ ├── vmaf_rb_v0.6.2.pkl.0001 │ ├── vmaf_rb_v0.6.2.pkl.0001.model │ ├── vmaf_rb_v0.6.2.pkl.0002 │ ├── vmaf_rb_v0.6.2.pkl.0002.model │ ├── vmaf_rb_v0.6.2.pkl.0003 │ ├── vmaf_rb_v0.6.2.pkl.0003.model │ ├── vmaf_rb_v0.6.2.pkl.0004 │ ├── vmaf_rb_v0.6.2.pkl.0004.model │ ├── vmaf_rb_v0.6.2.pkl.0005 │ ├── vmaf_rb_v0.6.2.pkl.0005.model │ ├── vmaf_rb_v0.6.2.pkl.0006 │ ├── vmaf_rb_v0.6.2.pkl.0006.model │ ├── vmaf_rb_v0.6.2.pkl.0007 │ ├── vmaf_rb_v0.6.2.pkl.0007.model │ ├── vmaf_rb_v0.6.2.pkl.0008 │ ├── vmaf_rb_v0.6.2.pkl.0008.model │ ├── vmaf_rb_v0.6.2.pkl.0009 │ ├── vmaf_rb_v0.6.2.pkl.0009.model │ ├── vmaf_rb_v0.6.2.pkl.0010 │ ├── vmaf_rb_v0.6.2.pkl.0010.model │ ├── vmaf_rb_v0.6.2.pkl.0011 │ ├── vmaf_rb_v0.6.2.pkl.0011.model │ ├── vmaf_rb_v0.6.2.pkl.0012 │ ├── vmaf_rb_v0.6.2.pkl.0012.model │ ├── vmaf_rb_v0.6.2.pkl.0013 │ ├── vmaf_rb_v0.6.2.pkl.0013.model │ ├── vmaf_rb_v0.6.2.pkl.0014 │ ├── vmaf_rb_v0.6.2.pkl.0014.model │ ├── vmaf_rb_v0.6.2.pkl.0015 │ ├── vmaf_rb_v0.6.2.pkl.0015.model │ ├── vmaf_rb_v0.6.2.pkl.0016 │ ├── vmaf_rb_v0.6.2.pkl.0016.model │ ├── vmaf_rb_v0.6.2.pkl.0017 │ ├── vmaf_rb_v0.6.2.pkl.0017.model │ ├── vmaf_rb_v0.6.2.pkl.0018 │ ├── vmaf_rb_v0.6.2.pkl.0018.model │ ├── vmaf_rb_v0.6.2.pkl.0019 │ ├── vmaf_rb_v0.6.2.pkl.0019.model │ └── vmaf_rb_v0.6.2.pkl.model ├── vmaf_rb_v0.6.3 │ ├── vmaf_rb_v0.6.3.json │ ├── vmaf_rb_v0.6.3.pkl │ ├── vmaf_rb_v0.6.3.pkl.0001 │ ├── vmaf_rb_v0.6.3.pkl.0001.model │ ├── vmaf_rb_v0.6.3.pkl.0002 │ ├── vmaf_rb_v0.6.3.pkl.0002.model │ ├── vmaf_rb_v0.6.3.pkl.0003 │ ├── vmaf_rb_v0.6.3.pkl.0003.model │ ├── vmaf_rb_v0.6.3.pkl.0004 │ ├── vmaf_rb_v0.6.3.pkl.0004.model │ ├── vmaf_rb_v0.6.3.pkl.0005 │ ├── vmaf_rb_v0.6.3.pkl.0005.model │ ├── vmaf_rb_v0.6.3.pkl.0006 │ ├── vmaf_rb_v0.6.3.pkl.0006.model │ ├── vmaf_rb_v0.6.3.pkl.0007 │ ├── vmaf_rb_v0.6.3.pkl.0007.model │ ├── vmaf_rb_v0.6.3.pkl.0008 │ ├── vmaf_rb_v0.6.3.pkl.0008.model │ ├── vmaf_rb_v0.6.3.pkl.0009 │ ├── vmaf_rb_v0.6.3.pkl.0009.model │ ├── vmaf_rb_v0.6.3.pkl.0010 │ ├── vmaf_rb_v0.6.3.pkl.0010.model │ ├── vmaf_rb_v0.6.3.pkl.0011 │ ├── vmaf_rb_v0.6.3.pkl.0011.model │ ├── vmaf_rb_v0.6.3.pkl.0012 │ ├── vmaf_rb_v0.6.3.pkl.0012.model │ ├── vmaf_rb_v0.6.3.pkl.0013 │ ├── vmaf_rb_v0.6.3.pkl.0013.model │ ├── vmaf_rb_v0.6.3.pkl.0014 │ ├── vmaf_rb_v0.6.3.pkl.0014.model │ ├── vmaf_rb_v0.6.3.pkl.0015 │ ├── vmaf_rb_v0.6.3.pkl.0015.model │ ├── vmaf_rb_v0.6.3.pkl.0016 │ ├── vmaf_rb_v0.6.3.pkl.0016.model │ ├── vmaf_rb_v0.6.3.pkl.0017 │ ├── vmaf_rb_v0.6.3.pkl.0017.model │ ├── vmaf_rb_v0.6.3.pkl.0018 │ ├── vmaf_rb_v0.6.3.pkl.0018.model │ ├── vmaf_rb_v0.6.3.pkl.0019 │ ├── vmaf_rb_v0.6.3.pkl.0019.model │ ├── vmaf_rb_v0.6.3.pkl.0020 │ ├── vmaf_rb_v0.6.3.pkl.0020.model │ └── vmaf_rb_v0.6.3.pkl.model ├── vmaf_v0.6.1.json └── vmaf_v0.6.1neg.json ├── python ├── .gitignore ├── DEVELOP.md ├── README.rst ├── pyproject.toml ├── requirements.txt ├── setup.py ├── test │ ├── __init__.py │ ├── asset_test.py │ ├── bd_rate_calculator_test.py │ ├── bootstrap_train_test_model_test.py │ ├── calculate_bd_rate_test.py │ ├── cambi_test.py │ ├── command_line_test.py │ ├── conftest.py │ ├── cross_validation_test.py │ ├── cy_test.py │ ├── doctest_test.py │ ├── executor_test.py │ ├── feature_assembler_test.py │ ├── feature_extractor_test.py │ ├── local_explainer_test.py │ ├── niqe_train_test_model_test.py │ ├── noref_feature_extractor_test.py │ ├── perf_metric_test.py │ ├── quality_runner_test.py │ ├── raw_extractor_test.py │ ├── reader_test.py │ ├── requirements.txt │ ├── resource │ │ ├── NFLX_dataset_public_raw.py │ │ ├── data_Toyama.mat │ │ ├── dataset_sample.py │ │ ├── example_batch_input │ │ ├── example_dataset.py │ │ ├── example_dataset_crop_pad.py │ │ ├── example_dataset_crop_pad_duration_sec.py │ │ ├── example_raw_dataset.py │ │ ├── example_raw_dataset2.py │ │ ├── example_raw_dataset3.py │ │ ├── example_raw_dataset4.py │ │ ├── feature_param_sample.py │ │ ├── feature_param_sample_with_optional_dict.py │ │ ├── feature_param_sample_with_optional_dict_good.py │ │ ├── model │ │ │ ├── vmaf_float_v0.6.1_nvd6.json │ │ │ ├── vmaf_float_v0.6.1_rdh540.json │ │ │ ├── vmaf_float_v0.6.1_vifks1o2.json │ │ │ ├── vmaf_float_v0.6.1_vifks2.json │ │ │ ├── vmaf_float_v0.6.1_vifks24o10.json │ │ │ ├── vmaf_float_v0.6.1_vifks2o3.json │ │ │ ├── vmaf_float_v0.6.1_vifks360o97.json │ │ │ ├── vmaf_float_v0.6.1_vifks3o2.json │ │ │ ├── vmaf_v0.6.1_nvd6.json │ │ │ ├── vmaf_v0.6.1_rdh2160_nvd1d5.json │ │ │ ├── vmaf_v0.6.1_rdh540.json │ │ │ ├── vmafplus_v0.5.2_test.json │ │ │ ├── vmafplus_v0.5.2boot_test.json │ │ │ ├── vmafplus_v0.5.2boot_test.pkl │ │ │ ├── vmafplus_v0.5.2boot_test.pkl.0001 │ │ │ ├── vmafplus_v0.5.2boot_test.pkl.0001.model │ │ │ ├── vmafplus_v0.5.2boot_test.pkl.0002 │ │ │ ├── vmafplus_v0.5.2boot_test.pkl.0002.model │ │ │ ├── vmafplus_v0.5.2boot_test.pkl.0003 │ │ │ ├── vmafplus_v0.5.2boot_test.pkl.0003.model │ │ │ ├── vmafplus_v0.5.2boot_test.pkl.0004 │ │ │ ├── vmafplus_v0.5.2boot_test.pkl.0004.model │ │ │ ├── vmafplus_v0.5.2boot_test.pkl.model │ │ │ ├── vmafplus_v0.5.2boot_test2.json │ │ │ ├── vmafplus_v0.5.2boot_test2.pkl │ │ │ ├── vmafplus_v0.5.2boot_test2.pkl.0001 │ │ │ ├── vmafplus_v0.5.2boot_test2.pkl.0001.model │ │ │ ├── vmafplus_v0.5.2boot_test2.pkl.0002 │ │ │ ├── vmafplus_v0.5.2boot_test2.pkl.0002.model │ │ │ ├── vmafplus_v0.5.2boot_test2.pkl.0003 │ │ │ ├── vmafplus_v0.5.2boot_test2.pkl.0003.model │ │ │ ├── vmafplus_v0.5.2boot_test2.pkl.0004 │ │ │ ├── vmafplus_v0.5.2boot_test2.pkl.0004.model │ │ │ ├── vmafplus_v0.5.2boot_test2.pkl.0005 │ │ │ ├── vmafplus_v0.5.2boot_test2.pkl.0005.model │ │ │ ├── vmafplus_v0.5.2boot_test2.pkl.0006 │ │ │ ├── vmafplus_v0.5.2boot_test2.pkl.0006.model │ │ │ ├── vmafplus_v0.5.2boot_test2.pkl.0007 │ │ │ ├── vmafplus_v0.5.2boot_test2.pkl.0007.model │ │ │ ├── vmafplus_v0.5.2boot_test2.pkl.0008 │ │ │ ├── vmafplus_v0.5.2boot_test2.pkl.0008.model │ │ │ ├── vmafplus_v0.5.2boot_test2.pkl.0009 │ │ │ ├── vmafplus_v0.5.2boot_test2.pkl.0009.model │ │ │ └── vmafplus_v0.5.2boot_test2.pkl.model │ │ ├── model_param_sample.py │ │ ├── raw_dataset_sample.py │ │ ├── result_with_none.txt │ │ ├── ssim_result_for_test.txt │ │ ├── test_dataset.py │ │ ├── test_dataset_bad_fps_rebufinds.py │ │ ├── test_dataset_diffyuv.py │ │ ├── test_dataset_fps_bad_rebufinds.py │ │ ├── test_dataset_fps_rebufinds.py │ │ ├── test_dataset_mixed.py │ │ ├── test_image_dataset.py │ │ ├── test_image_dataset_diffdim.py │ │ ├── test_image_dataset_diffdim2.py │ │ ├── test_image_dataset_diffdim_qualitywh.py │ │ ├── test_image_dataset_diffdim_qualitywh2.py │ │ ├── test_image_dataset_noisy.py │ │ ├── test_image_dataset_notyuv.py │ │ ├── test_image_dataset_notyuv_workfile_yuv_type.py │ │ ├── test_model_transform_add40.json │ │ ├── test_model_transform_add40.pkl │ │ ├── test_model_transform_add40.pkl.model │ │ ├── test_model_transform_add40_outltein.json │ │ ├── test_model_transform_add40_outltein.pkl │ │ ├── test_model_transform_add40_outltein.pkl.model │ │ ├── test_model_transform_add40_piecewiselinear.json │ │ ├── test_model_transform_add40_piecewiselinear_forced.json │ │ ├── test_motion2.json │ │ ├── test_motion2.pkl │ │ ├── test_motion2.pkl.model │ │ ├── test_read_dataset_dataset.py │ │ ├── test_read_dataset_dataset2.py │ │ ├── test_read_dataset_dataset3.py │ │ ├── vmaf_float_v0.6.1neg.inconsist.json │ │ ├── vmaf_float_v0.6.1neg.inconsist.pkl │ │ ├── vmaf_float_v0.6.1neg.inconsist.pkl.model │ │ ├── vmaf_v4.py │ │ ├── vmafplus_laptop_480source_vmafplusv2_sa.json │ │ ├── vmafplus_laptop_480source_vmafplusv2_sa.pkl │ │ ├── vmafplus_laptop_480source_vmafplusv2_sa.pkl.model │ │ ├── vmafplus_v6_bootstrap_test.py │ │ └── vmafplus_v6_bootstrap_test2.py │ ├── result_test.py │ ├── routine_test.py │ ├── testutil.py │ ├── third_party │ │ └── xiph │ │ │ └── vmafexec_feature_extractor_test.py │ ├── tools_test.py │ ├── train_test_model_test.py │ ├── vmafexec_feature_extractor_test.py │ └── vmafexec_test.py ├── tox.ini └── vmaf │ ├── __init__.py │ ├── config.py │ ├── core │ ├── __init__.py │ ├── adm_dwt2_cy.pyx │ ├── adm_dwt2_py.py │ ├── adm_dwt2_tools.py │ ├── asset.py │ ├── cambi_feature_extractor.py │ ├── cambi_quality_runner.py │ ├── cross_validation.py │ ├── executor.py │ ├── feature_assembler.py │ ├── feature_extractor.py │ ├── h5py_mixin.py │ ├── local_explainer.py │ ├── matlab_feature_extractor.py │ ├── matlab_quality_runner.py │ ├── mixin.py │ ├── niqe_train_test_model.py │ ├── nn_train_test_model.py │ ├── noref_feature_extractor.py │ ├── perf_metric.py │ ├── proc_func.py │ ├── quality_runner.py │ ├── quality_runner_extra.py │ ├── raw_extractor.py │ ├── result.py │ ├── result_store.py │ ├── train_test_model.py │ └── vmafexec_feature_extractor.py │ ├── model │ ├── vmaf_v0.6.1.json │ └── vmaf_v0.6.1neg.json │ ├── routine.py │ ├── script │ ├── __init__.py │ ├── convert_model_from_pkl_to_json.py │ ├── convert_vmaf_model_to_vmaf_no_enhn_gain_model.py │ ├── run_cleaning_cache.py │ ├── run_psnr.py │ ├── run_result_assembly.py │ ├── run_testing.py │ ├── run_toddnoiseclassifier.py │ ├── run_vmaf.py │ ├── run_vmaf_cross_validation.py │ └── run_vmaf_training.py │ ├── third_party │ ├── __init__.py │ └── xiph │ │ ├── __init__.py │ │ └── vmafexec_feature_extractor.py │ └── tools │ ├── __init__.py │ ├── bd_rate.py │ ├── bd_rate_calculator.py │ ├── convex_hull.py │ ├── decorator.py │ ├── exceptions.py │ ├── interpolation_utils.py │ ├── kimchi.py │ ├── misc.py │ ├── plot.py │ ├── reader.py │ ├── resource │ └── Hanley_McNeil.mat │ ├── scanf.py │ ├── sigproc.py │ ├── stats.py │ ├── testutils.py │ ├── typing_utils.py │ └── writer.py ├── resource ├── dataset │ ├── BSDS500_noisy_dataset.py │ ├── NFLX_dataset_public.py │ ├── NFLX_dataset_public_raw.py │ ├── NFLX_dataset_public_raw_last4outliers.py │ ├── VQEGHD3_dataset.py │ └── VQEGHD3_dataset_raw.py ├── doc │ ├── aom_ctc.md │ ├── bad_cases.md │ ├── cambi.md │ ├── conf_interval.md │ ├── datasets.md │ ├── docker.md │ ├── external_resource.md │ ├── faq.md │ ├── features.md │ ├── ffmpeg.md │ ├── index.md │ ├── matlab_usage.md │ ├── models.md │ ├── nflx_ctc.md │ ├── papers │ │ └── CAMBI_PCS2021.pdf │ ├── presentations │ │ ├── VMAF_ICIP17.pdf │ │ ├── VQEG_SAM_2018_023_VMAF_Variability.pdf │ │ ├── VQEG_SAM_2018_025_VMAF_4K.pdf │ │ └── VQEG_SAM_2018_111_AnalysisToolsInVMAF.pdf │ ├── python.md │ ├── references.md │ ├── release.md │ └── windows.md ├── example │ ├── example_batch_input │ ├── example_dataset.py │ ├── example_raw_dataset.py │ └── externals.py ├── feature_param │ ├── ssim.py │ ├── vmaf_feature_v1.py │ ├── vmaf_feature_v2.py │ ├── vmaf_feature_v3.py │ └── vmaf_feature_v6.py ├── images │ ├── CI.png │ ├── phone_model.png │ ├── scatter_testing.png │ ├── scatter_training.png │ ├── subsample.png │ ├── uml.png │ └── vmaf_logo.jpg ├── model_param │ ├── 5PL_v1.py │ ├── libsvmnusvr_v1.py │ ├── libsvmnusvr_v2.py │ ├── libsvmnusvr_v3.py │ └── randomforest_v1.py └── param │ ├── vmaf_v1.py │ ├── vmaf_v2.py │ ├── vmaf_v3.py │ ├── vmaf_v4.py │ ├── vmaf_v6.py │ ├── vmaf_v6_bootstrap.py │ ├── vmaf_v6_residue_bootstrap.py │ ├── vmaf_v7.2_bootstrap.py │ ├── vmaf_v7_bootstrap.py │ ├── vmaf_v8.py │ └── vmaf_v8_bootstrap.py ├── unittest └── workspace ├── checkpoints_dir └── .gitignore ├── dataset └── .gitignore ├── encode └── .gitignore ├── model └── .gitignore ├── model_param └── .gitignore ├── output └── .gitignore ├── result_store_dir └── .gitignore └── workdir └── .gitignore /.dockerignore: -------------------------------------------------------------------------------- 1 | matlab 2 | workspace 3 | python/.tox 4 | .git 5 | .venv 6 | *.mp4 7 | *.yuv 8 | *.mov 9 | -------------------------------------------------------------------------------- /.gitattributes: -------------------------------------------------------------------------------- 1 | # Set the default behavior, in case people don't have core.autocrlf set. 2 | * text=auto 3 | 4 | # The model file parser requires LF line endings 5 | *.pkl text eol=lf 6 | *.model text eol=lf 7 | -------------------------------------------------------------------------------- /.github/dependabot.yml: -------------------------------------------------------------------------------- 1 | version: 2 2 | updates: 3 | # Maintain dependencies for GitHub Actions 4 | - package-ecosystem: "github-actions" 5 | directory: "/" 6 | schedule: 7 | interval: "weekly" 8 | -------------------------------------------------------------------------------- /.github/workflows/docker.yml: -------------------------------------------------------------------------------- 1 | name: Docker 2 | on: 3 | push: 4 | pull_request: 5 | 6 | jobs: 7 | docker: 8 | runs-on: ubuntu-latest 9 | steps: 10 | - uses: actions/checkout@v4 11 | - name: Build Docker Image 12 | run: | 13 | docker build -t vmaf . 14 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | # Caches, build artifacts 2 | .DS_Store 3 | .cache/ 4 | *.egg* 5 | .gradle/ 6 | .idea/ 7 | *.py[cod] 8 | .pypirc 9 | .tox/ 10 | .*version 11 | .venv*/ 12 | __pycache__/ 13 | build/ 14 | dist/ 15 | vmaf_output.xml 16 | compile_commands.json 17 | -------------------------------------------------------------------------------- /Dockerfile: -------------------------------------------------------------------------------- 1 | FROM ubuntu:22.04 2 | 3 | # get and install building tools 4 | RUN apt-get update && \ 5 | apt-get install -y \ 6 | build-essential \ 7 | ninja-build \ 8 | nasm \ 9 | doxygen \ 10 | python3 \ 11 | python3-pip \ 12 | python3-venv \ 13 | xxd 14 | 15 | # retrieve source code 16 | COPY . /vmaf 17 | 18 | # setup environment 19 | ENV PATH=/vmaf:/vmaf/libvmaf/build/tools:$PATH 20 | 21 | # make vmaf 22 | RUN cd /vmaf && make clean && make 23 | 24 | # install python tools 25 | RUN pip3 install --no-cache-dir -r /vmaf/python/requirements.txt 26 | 27 | WORKDIR /vmaf 28 | 29 | ENV PYTHONPATH=python 30 | 31 | ENTRYPOINT [ "vmaf" ] 32 | -------------------------------------------------------------------------------- /OSSMETADATA: -------------------------------------------------------------------------------- 1 | osslifecycle=active -------------------------------------------------------------------------------- /libvmaf/doc/Doxyfile.in: -------------------------------------------------------------------------------- 1 | PROJECT_NAME = libvmaf 2 | OUTPUT_DIRECTORY = @DOXYGEN_OUTPUT@ 3 | STRIP_FROM_PATH = @DOXYGEN_STRIP@ 4 | OUTPUT_LANGUAGE = English 5 | TAB_SIZE = 4 6 | EXTRACT_ALL = YES 7 | OPTIMIZE_OUTPUT_FOR_C = YES 8 | DOXYFILE_ENCODING = UTF-8 9 | TYPEDEF_HIDES_STRUCT = YES 10 | 11 | QUIET = YES 12 | WARNINGS = YES 13 | WARN_IF_UNDOCUMENTED = YES 14 | 15 | INPUT = @DOXYGEN_INPUT@ 16 | FILE_PATTERNS = *.h 17 | 18 | GENERATE_HTML = YES 19 | GENERATE_LATEX = NO 20 | -------------------------------------------------------------------------------- /libvmaf/doc/meson.build: -------------------------------------------------------------------------------- 1 | if not get_option('enable_docs') 2 | subdir_done() 3 | endif 4 | 5 | doxygen = find_program('doxygen', required: false) 6 | 7 | if doxygen.found() 8 | conf_data = configuration_data() 9 | doxygen_input = [join_paths(meson.project_source_root(), 'include/libvmaf'), 10 | join_paths(meson.project_source_root(), 'src/feature'), 11 | ] 12 | 13 | conf_data.set('DOXYGEN_INPUT', ' '.join(doxygen_input)) 14 | conf_data.set('DOXYGEN_STRIP', join_paths(meson.project_source_root(), 'include')) 15 | conf_data.set('DOXYGEN_OUTPUT', meson.current_build_dir()) 16 | doxyfile = configure_file(input: 'Doxyfile.in', 17 | output: 'Doxyfile', 18 | configuration: conf_data) 19 | 20 | custom_target('doc', 21 | build_by_default: false, 22 | command: [doxygen, doxyfile], 23 | output: ['html'] 24 | ) 25 | endif 26 | -------------------------------------------------------------------------------- /libvmaf/include/libvmaf/feature.h: -------------------------------------------------------------------------------- 1 | /** 2 | * 3 | * Copyright 2016-2020 Netflix, Inc. 4 | * 5 | * Licensed under the BSD+Patent License (the "License"); 6 | * you may not use this file except in compliance with the License. 7 | * You may obtain a copy of the License at 8 | * 9 | * https://opensource.org/licenses/BSDplusPatent 10 | * 11 | * Unless required by applicable law or agreed to in writing, software 12 | * distributed under the License is distributed on an "AS IS" BASIS, 13 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | * See the License for the specific language governing permissions and 15 | * limitations under the License. 16 | * 17 | */ 18 | 19 | #ifndef __VMAF_FEATURE_H__ 20 | #define __VMAF_FEATURE_H__ 21 | 22 | #ifdef __cplusplus 23 | extern "C" { 24 | #endif 25 | 26 | typedef struct VmafFeatureDictionary VmafFeatureDictionary; 27 | 28 | int vmaf_feature_dictionary_set(VmafFeatureDictionary **dict, const char *key, 29 | const char *val); 30 | 31 | int vmaf_feature_dictionary_free(VmafFeatureDictionary **dict); 32 | 33 | #ifdef __cplusplus 34 | } 35 | #endif 36 | 37 | #endif /* __VMAF_FEATURE_H__ */ 38 | -------------------------------------------------------------------------------- /libvmaf/include/libvmaf/meson.build: -------------------------------------------------------------------------------- 1 | # installed version.h header generation 2 | version_h_data = configuration_data() 3 | version_h_data.set('VMAF_API_VERSION_MAJOR', vmaf_api_version_major) 4 | version_h_data.set('VMAF_API_VERSION_MINOR', vmaf_api_version_minor) 5 | version_h_data.set('VMAF_API_VERSION_PATCH', vmaf_api_version_revision) 6 | version_h_target = configure_file(input: 'version.h.in', 7 | output: 'version.h', 8 | configuration: version_h_data) 9 | 10 | is_cuda_enabled = get_option('enable_cuda') == true 11 | 12 | platform_specific_headers = [] 13 | 14 | if is_cuda_enabled 15 | platform_specific_headers += 'libvmaf_cuda.h' 16 | endif 17 | 18 | # install headers 19 | install_headers(['libvmaf.h', 20 | 'feature.h', 21 | 'model.h', 22 | 'picture.h'], 23 | version_h_target, 24 | platform_specific_headers, 25 | subdir : 'libvmaf') 26 | -------------------------------------------------------------------------------- /libvmaf/include/libvmaf/version.h.in: -------------------------------------------------------------------------------- 1 | /** 2 | * 3 | * Copyright 2016-2020 Netflix, Inc. 4 | * 5 | * Licensed under the BSD+Patent License (the "License"); 6 | * you may not use this file except in compliance with the License. 7 | * You may obtain a copy of the License at 8 | * 9 | * https://opensource.org/licenses/BSDplusPatent 10 | * 11 | * Unless required by applicable law or agreed to in writing, software 12 | * distributed under the License is distributed on an "AS IS" BASIS, 13 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | * See the License for the specific language governing permissions and 15 | * limitations under the License. 16 | * 17 | */ 18 | 19 | #ifndef VMAF_VERSION_H 20 | #define VMAF_VERSION_H 21 | 22 | #define VMAF_API_VERSION_MAJOR @VMAF_API_VERSION_MAJOR@ 23 | #define VMAF_API_VERSION_MINOR @VMAF_API_VERSION_MINOR@ 24 | #define VMAF_API_VERSION_PATCH @VMAF_API_VERSION_PATCH@ 25 | 26 | #endif /* VMAF_VERSION_H */ 27 | -------------------------------------------------------------------------------- /libvmaf/include/meson.build: -------------------------------------------------------------------------------- 1 | # Revision file (vcs_version.h) generation 2 | vmaf_git_dir = join_paths(libvmaf_src_root + '/../', '.git') 3 | rev_target = vcs_tag(command: [ 4 | 'git', '--git-dir', vmaf_git_dir, 5 | 'describe', '--tags', '--long', 6 | '--match', '?.*.*', '--always' 7 | ], 8 | input: 'vcs_version.h.in', 9 | output: 'vcs_version.h' 10 | ) 11 | 12 | subdir('libvmaf') 13 | -------------------------------------------------------------------------------- /libvmaf/include/vcs_version.h.in: -------------------------------------------------------------------------------- 1 | /* auto-generated, do not edit */ 2 | #define VMAF_VERSION "@VCS_TAG@" 3 | -------------------------------------------------------------------------------- /libvmaf/meson_options.txt: -------------------------------------------------------------------------------- 1 | option('enable_tests', 2 | type: 'boolean', 3 | value: true, 4 | description: 'Build libvmaf tests') 5 | 6 | option('enable_docs', 7 | type: 'boolean', 8 | value: true, 9 | description: 'Build libvmaf documentation') 10 | 11 | option('enable_asm', 12 | type: 'boolean', 13 | value: true, 14 | description: 'Build asm files, if available') 15 | 16 | option('enable_avx512', 17 | type: 'boolean', 18 | value: true, 19 | description: 'Build AVX-512 asm files, requires nasm 2.14') 20 | 21 | option('built_in_models', 22 | type: 'boolean', 23 | value: true, 24 | description: 'Compile default vmaf models into the library') 25 | 26 | option('enable_float', 27 | type: 'boolean', 28 | value: false, 29 | description: 'Compile floating-point feature extractors into the library') 30 | 31 | option('enable_cuda', 32 | type: 'boolean', 33 | value: false, 34 | description: 'Enable CUDA support') 35 | 36 | option('enable_nvtx', 37 | type: 'boolean', 38 | value: false, 39 | description: 'Enable NVTX range support') 40 | -------------------------------------------------------------------------------- /libvmaf/src/arm/cpu.c: -------------------------------------------------------------------------------- 1 | /** 2 | * 3 | * Copyright 2016-2022 Netflix, Inc. 4 | * 5 | * Licensed under the BSD+Patent License (the "License"); 6 | * you may not use this file except in compliance with the License. 7 | * You may obtain a copy of the License at 8 | * 9 | * https://opensource.org/licenses/BSDplusPatent 10 | * 11 | * Unless required by applicable law or agreed to in writing, software 12 | * distributed under the License is distributed on an "AS IS" BASIS, 13 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | * See the License for the specific language governing permissions and 15 | * limitations under the License. 16 | * 17 | */ 18 | 19 | #include "config.h" 20 | 21 | #include "arm/cpu.h" 22 | 23 | unsigned vmaf_get_cpu_flags_arm(void) { 24 | unsigned flags = 0; 25 | 26 | #ifdef ARCH_AARCH64 27 | flags |= VMAF_ARM_CPU_FLAG_NEON; 28 | #endif 29 | 30 | return flags; 31 | } 32 | -------------------------------------------------------------------------------- /libvmaf/src/arm/cpu.h: -------------------------------------------------------------------------------- 1 | /** 2 | * 3 | * Copyright 2016-2022 Netflix, Inc. 4 | * 5 | * Licensed under the BSD+Patent License (the "License"); 6 | * you may not use this file except in compliance with the License. 7 | * You may obtain a copy of the License at 8 | * 9 | * https://opensource.org/licenses/BSDplusPatent 10 | * 11 | * Unless required by applicable law or agreed to in writing, software 12 | * distributed under the License is distributed on an "AS IS" BASIS, 13 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | * See the License for the specific language governing permissions and 15 | * limitations under the License. 16 | * 17 | */ 18 | 19 | #ifndef __VMAF_SRC_ARM_CPU_H__ 20 | #define __VMAF_SRC_ARM_CPU_H__ 21 | 22 | enum CpuFlags { 23 | VMAF_ARM_CPU_FLAG_NEON = 1 << 0, 24 | }; 25 | 26 | unsigned vmaf_get_cpu_flags_arm(void); 27 | 28 | #endif /* __VMAF_SRC_ARM_CPU_H__ */ 29 | -------------------------------------------------------------------------------- /libvmaf/src/cpu.c: -------------------------------------------------------------------------------- 1 | /** 2 | * 3 | * Copyright 2016-2020 Netflix, Inc. 4 | * 5 | * Licensed under the BSD+Patent License (the "License"); 6 | * you may not use this file except in compliance with the License. 7 | * You may obtain a copy of the License at 8 | * 9 | * https://opensource.org/licenses/BSDplusPatent 10 | * 11 | * Unless required by applicable law or agreed to in writing, software 12 | * distributed under the License is distributed on an "AS IS" BASIS, 13 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | * See the License for the specific language governing permissions and 15 | * limitations under the License. 16 | * 17 | */ 18 | 19 | #include "config.h" 20 | #include "cpu.h" 21 | 22 | static unsigned flags = 0; 23 | static unsigned flags_mask = -1; 24 | 25 | void vmaf_init_cpu(void) 26 | { 27 | #if ARCH_X86 28 | flags = vmaf_get_cpu_flags_x86(); 29 | #elif ARCH_AARCH64 30 | flags = vmaf_get_cpu_flags_arm(); 31 | #endif 32 | } 33 | 34 | void vmaf_set_cpu_flags_mask(const unsigned mask) 35 | { 36 | flags_mask = mask; 37 | } 38 | 39 | unsigned vmaf_get_cpu_flags(void) 40 | { 41 | return flags & flags_mask; 42 | } 43 | -------------------------------------------------------------------------------- /libvmaf/src/cpu.h: -------------------------------------------------------------------------------- 1 | /** 2 | * 3 | * Copyright 2016-2020 Netflix, Inc. 4 | * 5 | * Licensed under the BSD+Patent License (the "License"); 6 | * you may not use this file except in compliance with the License. 7 | * You may obtain a copy of the License at 8 | * 9 | * https://opensource.org/licenses/BSDplusPatent 10 | * 11 | * Unless required by applicable law or agreed to in writing, software 12 | * distributed under the License is distributed on an "AS IS" BASIS, 13 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | * See the License for the specific language governing permissions and 15 | * limitations under the License. 16 | * 17 | */ 18 | 19 | #ifndef __VMAF_SRC_CPU_H__ 20 | #define __VMAF_SRC_CPU_H__ 21 | 22 | #ifdef __cplusplus 23 | extern "C" { 24 | #endif 25 | 26 | #include "config.h" 27 | 28 | #if ARCH_X86 29 | #include "x86/cpu.h" 30 | #elif ARCH_AARCH64 31 | #include "arm/cpu.h" 32 | #endif 33 | 34 | void vmaf_init_cpu(void); 35 | void vmaf_set_cpu_flags_mask(const unsigned mask); 36 | unsigned vmaf_get_cpu_flags(void); 37 | 38 | #ifdef __cplusplus 39 | } 40 | #endif 41 | 42 | #endif /* __VMAF_SRC_CPU_H__ */ 43 | -------------------------------------------------------------------------------- /libvmaf/src/feature/adm.h: -------------------------------------------------------------------------------- 1 | /** 2 | * 3 | * Copyright 2016-2020 Netflix, Inc. 4 | * 5 | * Licensed under the BSD+Patent License (the "License"); 6 | * you may not use this file except in compliance with the License. 7 | * You may obtain a copy of the License at 8 | * 9 | * https://opensource.org/licenses/BSDplusPatent 10 | * 11 | * Unless required by applicable law or agreed to in writing, software 12 | * distributed under the License is distributed on an "AS IS" BASIS, 13 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | * See the License for the specific language governing permissions and 15 | * limitations under the License. 16 | * 17 | */ 18 | 19 | int compute_adm(const float *ref, const float *dis, int w, int h, 20 | int ref_stride, int dis_stride, double *score, 21 | double *score_num, double *score_den, double *scores, 22 | double border_factor, double adm_enhn_gain_limit, 23 | double adm_norm_view_dist, int adm_ref_display_height, 24 | int adm_csf_mode); 25 | -------------------------------------------------------------------------------- /libvmaf/src/feature/alias.h: -------------------------------------------------------------------------------- 1 | /** 2 | * 3 | * Copyright 2016-2020 Netflix, Inc. 4 | * 5 | * Licensed under the BSD+Patent License (the "License"); 6 | * you may not use this file except in compliance with the License. 7 | * You may obtain a copy of the License at 8 | * 9 | * https://opensource.org/licenses/BSDplusPatent 10 | * 11 | * Unless required by applicable law or agreed to in writing, software 12 | * distributed under the License is distributed on an "AS IS" BASIS, 13 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | * See the License for the specific language governing permissions and 15 | * limitations under the License. 16 | * 17 | */ 18 | 19 | const char *vmaf_feature_name_alias(const char *feature_name); 20 | -------------------------------------------------------------------------------- /libvmaf/src/feature/ansnr.h: -------------------------------------------------------------------------------- 1 | /** 2 | * 3 | * Copyright 2016-2020 Netflix, Inc. 4 | * 5 | * Licensed under the BSD+Patent License (the "License"); 6 | * you may not use this file except in compliance with the License. 7 | * You may obtain a copy of the License at 8 | * 9 | * https://opensource.org/licenses/BSDplusPatent 10 | * 11 | * Unless required by applicable law or agreed to in writing, software 12 | * distributed under the License is distributed on an "AS IS" BASIS, 13 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | * See the License for the specific language governing permissions and 15 | * limitations under the License. 16 | * 17 | */ 18 | 19 | int compute_ansnr(const float *ref, const float *dis, int w, int h, 20 | int ref_stride, int dis_stride, 21 | double *score, double *score_psnr, double peak, double psnr_max); 22 | -------------------------------------------------------------------------------- /libvmaf/src/feature/ansnr_options.h: -------------------------------------------------------------------------------- 1 | /** 2 | * 3 | * Copyright 2016-2020 Netflix, Inc. 4 | * 5 | * Licensed under the BSD+Patent License (the "License"); 6 | * you may not use this file except in compliance with the License. 7 | * You may obtain a copy of the License at 8 | * 9 | * https://opensource.org/licenses/BSDplusPatent 10 | * 11 | * Unless required by applicable law or agreed to in writing, software 12 | * distributed under the License is distributed on an "AS IS" BASIS, 13 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | * See the License for the specific language governing permissions and 15 | * limitations under the License. 16 | * 17 | */ 18 | 19 | #pragma once 20 | 21 | #ifndef ANSNR_OPTIONS_H_ 22 | #define ANSNR_OPTIONS_H_ 23 | 24 | /* Whether to use border replication instead of zero extension. */ 25 | /* #define ANSNR_OPT_BORDER_REPLICATE */ 26 | 27 | /* Whether to save intermediate results to files. */ 28 | /* #define ANSNR_OPT_DEBUG_DUMP */ 29 | 30 | /* Whether to use a 1-D approximation of filters. */ 31 | /* #define ANSNR_OPT_FILTER_1D */ 32 | 33 | /* Whether to normalize result by dividing against maximum ANSNR. */ 34 | /* #define ANSNR_OPT_NORMALIZE */ 35 | 36 | #endif /* ANSNR_OPTIONS_H_ */ 37 | -------------------------------------------------------------------------------- /libvmaf/src/feature/arm64/adm_neon.h: -------------------------------------------------------------------------------- 1 | 2 | #ifndef ARM_64_ADM_H_ 3 | #define ARM_64_ADM_H_ 4 | 5 | #include "feature/integer_adm.h" 6 | 7 | void adm_dwt2_8_neon(const uint8_t *src, const adm_dwt_band_t *dst, 8 | AdmBuffer *buf, int w, int h, int src_stride, 9 | int dst_stride); 10 | 11 | #endif /* ARM64_ADM_H_ */ 12 | -------------------------------------------------------------------------------- /libvmaf/src/feature/arm64/vif_neon.h: -------------------------------------------------------------------------------- 1 | 2 | #ifndef ARM64_VIF_H_ 3 | #define ARM64_VIF_H_ 4 | 5 | #include "feature/integer_vif.h" 6 | 7 | void vif_subsample_rd_8_neon(VifBuffer buf, unsigned w, unsigned h); 8 | 9 | void vif_subsample_rd_16_neon(VifBuffer buf, unsigned w, unsigned h, int scale, 10 | int bpc); 11 | 12 | void vif_statistic_8_neon(struct VifPublicState *s, float *num, float *den, unsigned w, unsigned h); 13 | 14 | void vif_statistic_16_neon(struct VifPublicState *s, float *num, float *den, unsigned w, unsigned h, int bpc, int scale); 15 | 16 | #endif /* ARM64_VIF_H_ */ 17 | -------------------------------------------------------------------------------- /libvmaf/src/feature/common/alignment.c: -------------------------------------------------------------------------------- 1 | /** 2 | * 3 | * Copyright 2016-2020 Netflix, Inc. 4 | * 5 | * Licensed under the BSD+Patent License (the "License"); 6 | * you may not use this file except in compliance with the License. 7 | * You may obtain a copy of the License at 8 | * 9 | * https://opensource.org/licenses/BSDplusPatent 10 | * 11 | * Unless required by applicable law or agreed to in writing, software 12 | * distributed under the License is distributed on an "AS IS" BASIS, 13 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | * See the License for the specific language governing permissions and 15 | * limitations under the License. 16 | * 17 | */ 18 | 19 | #include "alignment.h" 20 | 21 | int vmaf_floorn(int n, int m) 22 | { 23 | return n - n % m; 24 | } 25 | 26 | int vmaf_ceiln(int n, int m) 27 | { 28 | return n % m ? n + (m - n % m) : n; 29 | } 30 | -------------------------------------------------------------------------------- /libvmaf/src/feature/common/alignment.h: -------------------------------------------------------------------------------- 1 | /** 2 | * 3 | * Copyright 2016-2020 Netflix, Inc. 4 | * 5 | * Licensed under the BSD+Patent License (the "License"); 6 | * you may not use this file except in compliance with the License. 7 | * You may obtain a copy of the License at 8 | * 9 | * https://opensource.org/licenses/BSDplusPatent 10 | * 11 | * Unless required by applicable law or agreed to in writing, software 12 | * distributed under the License is distributed on an "AS IS" BASIS, 13 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | * See the License for the specific language governing permissions and 15 | * limitations under the License. 16 | * 17 | */ 18 | 19 | #ifndef ALIGNMENT_H_ 20 | #define ALIGNMENT_H_ 21 | 22 | /* Required for AVX. */ 23 | #define VMAF_ALIGNMENT 32 24 | 25 | int vmaf_floorn(int n, int m); 26 | int vmaf_ceiln(int n, int m); 27 | 28 | #endif // ALIGNMENT_H_ 29 | -------------------------------------------------------------------------------- /libvmaf/src/feature/common/blur_array.h: -------------------------------------------------------------------------------- 1 | /* 2 | * blur_array.h 3 | * 4 | * Created on: 12.02.2018 5 | * Author: thomas 6 | */ 7 | 8 | #ifndef VMAF_FEATURE_SRC_BLUR_ARRAY_H_ 9 | #define VMAF_FEATURE_SRC_BLUR_ARRAY_H_ 10 | 11 | #include <stdlib.h> 12 | #include <pthread.h> 13 | #include "mem.h" 14 | 15 | #define MAX_NUM_THREADS 128 16 | typedef struct 17 | { 18 | int frame_idx; 19 | float *blur_buf; 20 | int reference_count; 21 | 22 | 23 | } BLUR_BUF_STRUCT; 24 | 25 | typedef struct 26 | { 27 | BLUR_BUF_STRUCT blur_buf_array[MAX_NUM_THREADS]; 28 | int actual_length; 29 | size_t buffer_size; 30 | pthread_mutex_t block; 31 | 32 | } BLUR_BUF_ARRAY; 33 | 34 | int init_blur_array(BLUR_BUF_ARRAY* arr, int array_length, size_t size, size_t alignement); 35 | 36 | float* get_free_blur_buf_slot(BLUR_BUF_ARRAY* arr, int frame_idx); 37 | 38 | int get_blur_buf_reference_count(BLUR_BUF_ARRAY* arr, int frame_idx); 39 | 40 | int release_blur_buf_slot(BLUR_BUF_ARRAY* arr, int search_frame_idx); 41 | 42 | int release_blur_buf_reference(BLUR_BUF_ARRAY* arr, int search_frame_idx); 43 | 44 | float* get_blur_buf(BLUR_BUF_ARRAY* arr, int search_frame_idx); 45 | 46 | int put_blur_buf(BLUR_BUF_ARRAY* arr, int frame_idx, float* blur_buf); 47 | 48 | void free_blur_buf(BLUR_BUF_ARRAY* arr); 49 | 50 | #endif /* VMAF_FEATURE_SRC_BLUR_ARRAY_H_ */ 51 | -------------------------------------------------------------------------------- /libvmaf/src/feature/common/macros.h: -------------------------------------------------------------------------------- 1 | /** 2 | * 3 | * Copyright 2016-2020 Netflix, Inc. 4 | * 5 | * Licensed under the BSD+Patent License (the "License"); 6 | * you may not use this file except in compliance with the License. 7 | * You may obtain a copy of the License at 8 | * 9 | * https://opensource.org/licenses/BSDplusPatent 10 | * 11 | * Unless required by applicable law or agreed to in writing, software 12 | * distributed under the License is distributed on an "AS IS" BASIS, 13 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | * See the License for the specific language governing permissions and 15 | * limitations under the License. 16 | * 17 | */ 18 | 19 | #ifndef MACROS_H_ 20 | #define MACROS_H_ 21 | 22 | #if defined(_MSC_VER) 23 | #define FORCE_INLINE __forceinline 24 | #define UNUSED_FUNCTION /**/ 25 | #else 26 | #define FORCE_INLINE __attribute__((always_inline)) inline 27 | #define UNUSED_FUNCTION __attribute__((unused)) 28 | #endif 29 | #define RESTRICT __restrict 30 | 31 | #endif // MACROS_H_ 32 | -------------------------------------------------------------------------------- /libvmaf/src/feature/cuda/integer_motion_cuda.h: -------------------------------------------------------------------------------- 1 | /** 2 | * 3 | * Copyright 2016-2023 Netflix, Inc. 4 | * Copyright 2021 NVIDIA Corporation. 5 | * 6 | * Licensed under the BSD+Patent License (the "License"); 7 | * you may not use this file except in compliance with the License. 8 | * You may obtain a copy of the License at 9 | * 10 | * https://opensource.org/licenses/BSDplusPatent 11 | * 12 | * Unless required by applicable law or agreed to in writing, software 13 | * distributed under the License is distributed on an "AS IS" BASIS, 14 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 15 | * See the License for the specific language governing permissions and 16 | * limitations under the License. 17 | * 18 | */ 19 | 20 | #ifndef FEATURE_MOTION_CUDA_H_ 21 | #define FEATURE_MOTION_CUDA_H_ 22 | 23 | #include <stdint.h> 24 | #include "integer_motion.h" 25 | #include "common.h" 26 | 27 | extern const unsigned char motion_score_ptx[]; 28 | #endif /* _FEATURE_MOTION_CUDA_H_ */ 29 | -------------------------------------------------------------------------------- /libvmaf/src/feature/feature_name.h: -------------------------------------------------------------------------------- 1 | /** 2 | * 3 | * Copyright 2016-2020 Netflix, Inc. 4 | * 5 | * Licensed under the BSD+Patent License (the "License"); 6 | * you may not use this file except in compliance with the License. 7 | * You may obtain a copy of the License at 8 | * 9 | * https://opensource.org/licenses/BSDplusPatent 10 | * 11 | * Unless required by applicable law or agreed to in writing, software 12 | * distributed under the License is distributed on an "AS IS" BASIS, 13 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | * See the License for the specific language governing permissions and 15 | * limitations under the License. 16 | * 17 | */ 18 | 19 | #ifndef __VMAF_FEATURE_NAME_H__ 20 | #define __VMAF_FEATURE_NAME_H__ 21 | 22 | #include "dict.h" 23 | #include "opt.h" 24 | 25 | char *vmaf_feature_name_from_options(const char *name, const VmafOption *opts, 26 | void *obj); 27 | 28 | VmafDictionary * 29 | vmaf_feature_name_dict_from_provided_features(const char **provided_features, 30 | const VmafOption *opts, void *obj); 31 | 32 | #endif /* __VMAF_FEATURE_NAME_H__ */ 33 | -------------------------------------------------------------------------------- /libvmaf/src/feature/iqa/iqa_options.h: -------------------------------------------------------------------------------- 1 | /** 2 | * 3 | * Copyright 2016-2020 Netflix, Inc. 4 | * 5 | * Licensed under the BSD+Patent License (the "License"); 6 | * you may not use this file except in compliance with the License. 7 | * You may obtain a copy of the License at 8 | * 9 | * https://opensource.org/licenses/BSDplusPatent 10 | * 11 | * Unless required by applicable law or agreed to in writing, software 12 | * distributed under the License is distributed on an "AS IS" BASIS, 13 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | * See the License for the specific language governing permissions and 15 | * limitations under the License. 16 | * 17 | */ 18 | 19 | #pragma once 20 | 21 | #ifndef IQA_OPTIONS_H_ 22 | #define IQA_OPTIONS_H_ 23 | 24 | /* Whether to use 1D separable convolution */ 25 | #define IQA_CONVOLVE_1D 26 | 27 | #endif /* IQA_OPTIONS_H_ */ 28 | -------------------------------------------------------------------------------- /libvmaf/src/feature/mkdirp.h: -------------------------------------------------------------------------------- 1 | 2 | // 3 | // mkdirp.h 4 | // 5 | // Copyright (c) 2013 Stephen Mathieson 6 | // MIT licensed 7 | // 8 | 9 | #ifndef MKDIRP 10 | #define MKDIRP 11 | 12 | #include <sys/types.h> 13 | #include <sys/stat.h> 14 | 15 | /* 16 | * Recursively `mkdir(path, mode)` 17 | */ 18 | 19 | int mkdirp(const char *, mode_t ); 20 | 21 | #endif 22 | -------------------------------------------------------------------------------- /libvmaf/src/feature/moment.h: -------------------------------------------------------------------------------- 1 | /** 2 | * 3 | * Copyright 2016-2020 Netflix, Inc. 4 | * 5 | * Licensed under the BSD+Patent License (the "License"); 6 | * you may not use this file except in compliance with the License. 7 | * You may obtain a copy of the License at 8 | * 9 | * https://opensource.org/licenses/BSDplusPatent 10 | * 11 | * Unless required by applicable law or agreed to in writing, software 12 | * distributed under the License is distributed on an "AS IS" BASIS, 13 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | * See the License for the specific language governing permissions and 15 | * limitations under the License. 16 | * 17 | */ 18 | 19 | int compute_1st_moment(const float *pic, int w, int h, int stride, double *score); 20 | int compute_2nd_moment(const float *pic, int w, int h, int stride, double *score); 21 | -------------------------------------------------------------------------------- /libvmaf/src/feature/moment_options.h: -------------------------------------------------------------------------------- 1 | /** 2 | * 3 | * Copyright 2016-2020 Netflix, Inc. 4 | * 5 | * Licensed under the BSD+Patent License (the "License"); 6 | * you may not use this file except in compliance with the License. 7 | * You may obtain a copy of the License at 8 | * 9 | * https://opensource.org/licenses/BSDplusPatent 10 | * 11 | * Unless required by applicable law or agreed to in writing, software 12 | * distributed under the License is distributed on an "AS IS" BASIS, 13 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | * See the License for the specific language governing permissions and 15 | * limitations under the License. 16 | * 17 | */ 18 | 19 | #pragma once 20 | 21 | #ifndef MOMENT_OPTIONS_H_ 22 | #define MOMENT_OPTIONS_H_ 23 | 24 | #endif /* MOMENT_OPTIONS_H_ */ 25 | -------------------------------------------------------------------------------- /libvmaf/src/feature/motion.h: -------------------------------------------------------------------------------- 1 | /** 2 | * 3 | * Copyright 2016-2020 Netflix, Inc. 4 | * 5 | * Licensed under the BSD+Patent License (the "License"); 6 | * you may not use this file except in compliance with the License. 7 | * You may obtain a copy of the License at 8 | * 9 | * https://opensource.org/licenses/BSDplusPatent 10 | * 11 | * Unless required by applicable law or agreed to in writing, software 12 | * distributed under the License is distributed on an "AS IS" BASIS, 13 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | * See the License for the specific language governing permissions and 15 | * limitations under the License. 16 | * 17 | */ 18 | 19 | int compute_motion(const float *ref, const float *dis, int w, int h, int ref_stride, int dis_stride, double *score); 20 | -------------------------------------------------------------------------------- /libvmaf/src/feature/motion_options.h: -------------------------------------------------------------------------------- 1 | /** 2 | * 3 | * Copyright 2016-2020 Netflix, Inc. 4 | * 5 | * Licensed under the BSD+Patent License (the "License"); 6 | * you may not use this file except in compliance with the License. 7 | * You may obtain a copy of the License at 8 | * 9 | * https://opensource.org/licenses/BSDplusPatent 10 | * 11 | * Unless required by applicable law or agreed to in writing, software 12 | * distributed under the License is distributed on an "AS IS" BASIS, 13 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | * See the License for the specific language governing permissions and 15 | * limitations under the License. 16 | * 17 | */ 18 | 19 | #pragma once 20 | 21 | #ifndef MOTION_OPTIONS_H_ 22 | #define MOTION_OPTIONS_H_ 23 | 24 | #endif /* MOTION_OPTIONS_H_ */ 25 | -------------------------------------------------------------------------------- /libvmaf/src/feature/motion_tools.h: -------------------------------------------------------------------------------- 1 | /** 2 | * 3 | * Copyright 2016-2020 Netflix, Inc. 4 | * 5 | * Licensed under the BSD+Patent License (the "License"); 6 | * you may not use this file except in compliance with the License. 7 | * You may obtain a copy of the License at 8 | * 9 | * https://opensource.org/licenses/BSDplusPatent 10 | * 11 | * Unless required by applicable law or agreed to in writing, software 12 | * distributed under the License is distributed on an "AS IS" BASIS, 13 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | * See the License for the specific language governing permissions and 15 | * limitations under the License. 16 | * 17 | */ 18 | 19 | #pragma once 20 | 21 | #ifndef MOTION_TOOLS_H_ 22 | #define MOTION_TOOLS_H_ 23 | 24 | static const float FILTER_5_s[5] = { 25 | 0.054488685, 26 | 0.244201342, 27 | 0.402619947, 28 | 0.244201342, 29 | 0.054488685}; 30 | 31 | #endif /* MOTION_TOOLS_H_ */ 32 | -------------------------------------------------------------------------------- /libvmaf/src/feature/ms_ssim.h: -------------------------------------------------------------------------------- 1 | /** 2 | * 3 | * Copyright 2016-2020 Netflix, Inc. 4 | * 5 | * Licensed under the BSD+Patent License (the "License"); 6 | * you may not use this file except in compliance with the License. 7 | * You may obtain a copy of the License at 8 | * 9 | * https://opensource.org/licenses/BSDplusPatent 10 | * 11 | * Unless required by applicable law or agreed to in writing, software 12 | * distributed under the License is distributed on an "AS IS" BASIS, 13 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | * See the License for the specific language governing permissions and 15 | * limitations under the License. 16 | * 17 | */ 18 | 19 | int compute_ms_ssim(const float *ref, const float *cmp, int w, int h, 20 | int ref_stride, int cmp_stride, double *score, 21 | double* l_scores, double* c_scores, double* s_scores); 22 | -------------------------------------------------------------------------------- /libvmaf/src/feature/offset.c: -------------------------------------------------------------------------------- 1 | /** 2 | * 3 | * Copyright 2016-2020 Netflix, Inc. 4 | * 5 | * Licensed under the BSD+Patent License (the "License"); 6 | * you may not use this file except in compliance with the License. 7 | * You may obtain a copy of the License at 8 | * 9 | * https://opensource.org/licenses/BSDplusPatent 10 | * 11 | * Unless required by applicable law or agreed to in writing, software 12 | * distributed under the License is distributed on an "AS IS" BASIS, 13 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | * See the License for the specific language governing permissions and 15 | * limitations under the License. 16 | * 17 | */ 18 | 19 | /** 20 | * Note: stride is in terms of bytes 21 | */ 22 | int offset_image_s(float *buf, float off, int width, int height, int stride) 23 | { 24 | char *byte_ptr = (char *)buf; 25 | int ret = 1; 26 | int i, j; 27 | 28 | for (i = 0; i < height; ++i) 29 | { 30 | float *row_ptr = (float *)byte_ptr; 31 | 32 | for (j = 0; j < width; ++j) 33 | { 34 | row_ptr[j] += off; 35 | } 36 | 37 | byte_ptr += stride; 38 | } 39 | 40 | ret = 0; 41 | 42 | return ret; 43 | } 44 | -------------------------------------------------------------------------------- /libvmaf/src/feature/offset.h: -------------------------------------------------------------------------------- 1 | /** 2 | * 3 | * Copyright 2016-2020 Netflix, Inc. 4 | * 5 | * Licensed under the BSD+Patent License (the "License"); 6 | * you may not use this file except in compliance with the License. 7 | * You may obtain a copy of the License at 8 | * 9 | * https://opensource.org/licenses/BSDplusPatent 10 | * 11 | * Unless required by applicable law or agreed to in writing, software 12 | * distributed under the License is distributed on an "AS IS" BASIS, 13 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | * See the License for the specific language governing permissions and 15 | * limitations under the License. 16 | * 17 | */ 18 | 19 | #ifndef OFFSET_H_ 20 | #define OFFSET_H_ 21 | 22 | /* Whether to use [0,255] or [-128,127] input pixel range. */ 23 | //#define OPT_RANGE_PIXEL_OFFSET 0 24 | #define OPT_RANGE_PIXEL_OFFSET (-128) 25 | 26 | int offset_image_s(float *buf, float off, int width, int height, int stride); 27 | 28 | #endif /* OFFSET_H_ */ 29 | -------------------------------------------------------------------------------- /libvmaf/src/feature/picture_copy.h: -------------------------------------------------------------------------------- 1 | /** 2 | * 3 | * Copyright 2016-2020 Netflix, Inc. 4 | * 5 | * Licensed under the BSD+Patent License (the "License"); 6 | * you may not use this file except in compliance with the License. 7 | * You may obtain a copy of the License at 8 | * 9 | * https://opensource.org/licenses/BSDplusPatent 10 | * 11 | * Unless required by applicable law or agreed to in writing, software 12 | * distributed under the License is distributed on an "AS IS" BASIS, 13 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | * See the License for the specific language governing permissions and 15 | * limitations under the License. 16 | * 17 | */ 18 | #include <stddef.h> 19 | 20 | void picture_copy(float *dst, ptrdiff_t dst_stride, VmafPicture *src, 21 | int offset, unsigned bpc); 22 | -------------------------------------------------------------------------------- /libvmaf/src/feature/psnr.h: -------------------------------------------------------------------------------- 1 | /** 2 | * 3 | * Copyright 2016-2020 Netflix, Inc. 4 | * 5 | * Licensed under the BSD+Patent License (the "License"); 6 | * you may not use this file except in compliance with the License. 7 | * You may obtain a copy of the License at 8 | * 9 | * https://opensource.org/licenses/BSDplusPatent 10 | * 11 | * Unless required by applicable law or agreed to in writing, software 12 | * distributed under the License is distributed on an "AS IS" BASIS, 13 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | * See the License for the specific language governing permissions and 15 | * limitations under the License. 16 | * 17 | */ 18 | 19 | int compute_psnr(const float *ref, const float *dis, int w, int h, 20 | int ref_stride, int dis_stride, 21 | double *score, double peak, double psnr_max); 22 | -------------------------------------------------------------------------------- /libvmaf/src/feature/psnr_options.h: -------------------------------------------------------------------------------- 1 | /** 2 | * 3 | * Copyright 2016-2020 Netflix, Inc. 4 | * 5 | * Licensed under the BSD+Patent License (the "License"); 6 | * you may not use this file except in compliance with the License. 7 | * You may obtain a copy of the License at 8 | * 9 | * https://opensource.org/licenses/BSDplusPatent 10 | * 11 | * Unless required by applicable law or agreed to in writing, software 12 | * distributed under the License is distributed on an "AS IS" BASIS, 13 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | * See the License for the specific language governing permissions and 15 | * limitations under the License. 16 | * 17 | */ 18 | 19 | #pragma once 20 | 21 | #ifndef PSNR_OPTIONS_H_ 22 | #define PSNR_OPTIONS_H_ 23 | 24 | #endif /* PSNR_OPTIONS_H_ */ 25 | -------------------------------------------------------------------------------- /libvmaf/src/feature/psnr_tools.h: -------------------------------------------------------------------------------- 1 | /** 2 | * 3 | * Copyright 2016-2020 Netflix, Inc. 4 | * 5 | * Licensed under the BSD+Patent License (the "License"); 6 | * you may not use this file except in compliance with the License. 7 | * You may obtain a copy of the License at 8 | * 9 | * https://opensource.org/licenses/BSDplusPatent 10 | * 11 | * Unless required by applicable law or agreed to in writing, software 12 | * distributed under the License is distributed on an "AS IS" BASIS, 13 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | * See the License for the specific language governing permissions and 15 | * limitations under the License. 16 | * 17 | */ 18 | 19 | #ifndef PSNR_TOOLS_H_ 20 | #define PSNR_TOOLS_H_ 21 | 22 | int psnr_constants(const char *fmt, double *peak, double *psnr_max); 23 | 24 | #endif /* PSNR_TOOLS_H_ */ -------------------------------------------------------------------------------- /libvmaf/src/feature/ssim.h: -------------------------------------------------------------------------------- 1 | /** 2 | * 3 | * Copyright 2016-2020 Netflix, Inc. 4 | * 5 | * Licensed under the BSD+Patent License (the "License"); 6 | * you may not use this file except in compliance with the License. 7 | * You may obtain a copy of the License at 8 | * 9 | * https://opensource.org/licenses/BSDplusPatent 10 | * 11 | * Unless required by applicable law or agreed to in writing, software 12 | * distributed under the License is distributed on an "AS IS" BASIS, 13 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | * See the License for the specific language governing permissions and 15 | * limitations under the License. 16 | * 17 | */ 18 | 19 | int compute_ssim(const float *ref, const float *cmp, int w, int h, 20 | int ref_stride, int cmp_stride, double *score, 21 | double *l_score, double *c_score, double *s_score); 22 | -------------------------------------------------------------------------------- /libvmaf/src/feature/vif.h: -------------------------------------------------------------------------------- 1 | /** 2 | * 3 | * Copyright 2016-2020 Netflix, Inc. 4 | * 5 | * Licensed under the BSD+Patent License (the "License"); 6 | * you may not use this file except in compliance with the License. 7 | * You may obtain a copy of the License at 8 | * 9 | * https://opensource.org/licenses/BSDplusPatent 10 | * 11 | * Unless required by applicable law or agreed to in writing, software 12 | * distributed under the License is distributed on an "AS IS" BASIS, 13 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | * See the License for the specific language governing permissions and 15 | * limitations under the License. 16 | * 17 | */ 18 | 19 | int compute_vif(const float *ref, const float *dis, int w, int h, int ref_stride, int dis_stride, 20 | double *score, double *score_num, double *score_den, double *scores, 21 | double vif_enhn_gain_limit, double vif_kernelscale); 22 | -------------------------------------------------------------------------------- /libvmaf/src/feature/x86/adm_avx2.h: -------------------------------------------------------------------------------- 1 | /** 2 | * 3 | * Copyright 2016-2020 Netflix, Inc. 4 | * 5 | * Licensed under the BSD+Patent License (the "License"); 6 | * you may not use this file except in compliance with the License. 7 | * You may obtain a copy of the License at 8 | * 9 | * https://opensource.org/licenses/BSDplusPatent 10 | * 11 | * Unless required by applicable law or agreed to in writing, software 12 | * distributed under the License is distributed on an "AS IS" BASIS, 13 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | * See the License for the specific language governing permissions and 15 | * limitations under the License. 16 | * 17 | */ 18 | 19 | #ifndef X86_AVX2_ADM_H_ 20 | #define X86_AVX2_ADM_H_ 21 | 22 | #include "feature/integer_adm.h" 23 | 24 | void adm_dwt2_8_avx2(const uint8_t *src, const adm_dwt_band_t *dst, 25 | AdmBuffer *buf, int w, int h, int src_stride, 26 | int dst_stride); 27 | 28 | #endif /* X86_AVX2_ADM_H_ */ 29 | -------------------------------------------------------------------------------- /libvmaf/src/feature/x86/cambi_avx2.h: -------------------------------------------------------------------------------- 1 | /** 2 | * 3 | * Copyright 2016-2020 Netflix, Inc. 4 | * 5 | * Licensed under the BSD+Patent License (the "License"); 6 | * you may not use this file except in compliance with the License. 7 | * You may obtain a copy of the License at 8 | * 9 | * https://opensource.org/licenses/BSDplusPatent 10 | * 11 | * Unless required by applicable law or agreed to in writing, software 12 | * distributed under the License is distributed on an "AS IS" BASIS, 13 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | * See the License for the specific language governing permissions and 15 | * limitations under the License. 16 | * 17 | */ 18 | 19 | #ifndef X86_AVX2_CAMBI_H_ 20 | #define X86_AVX2_CAMBI_H_ 21 | 22 | #include <stddef.h> 23 | #include <stdint.h> 24 | 25 | void cambi_increment_range_avx2(uint16_t *arr, int left, int right); 26 | 27 | void cambi_decrement_range_avx2(uint16_t *arr, int left, int right); 28 | 29 | void get_derivative_data_for_row_avx2(const uint16_t *image_data, uint16_t *derivative_buffer, int width, int height, int row, int stride); 30 | 31 | #endif /* X86_AVX2_CAMBI_H_ */ 32 | -------------------------------------------------------------------------------- /libvmaf/src/feature/x86/motion_avx2.h: -------------------------------------------------------------------------------- 1 | /** 2 | * 3 | * Copyright 2016-2020 Netflix, Inc. 4 | * 5 | * Licensed under the BSD+Patent License (the "License"); 6 | * you may not use this file except in compliance with the License. 7 | * You may obtain a copy of the License at 8 | * 9 | * https://opensource.org/licenses/BSDplusPatent 10 | * 11 | * Unless required by applicable law or agreed to in writing, software 12 | * distributed under the License is distributed on an "AS IS" BASIS, 13 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | * See the License for the specific language governing permissions and 15 | * limitations under the License. 16 | * 17 | */ 18 | 19 | #ifndef X86_AVX2_MOTION_H_ 20 | #define X86_AVX2_MOTION_H_ 21 | 22 | #include <stdint.h> 23 | 24 | void x_convolution_16_avx2(const uint16_t *src, uint16_t *dst, unsigned width, 25 | unsigned height, ptrdiff_t src_stride, 26 | ptrdiff_t dst_stride); 27 | 28 | #endif /* X86_AVX2_MOTION_H_ */ 29 | -------------------------------------------------------------------------------- /libvmaf/src/feature/x86/motion_avx512.h: -------------------------------------------------------------------------------- 1 | /** 2 | * 3 | * Copyright 2016-2020 Netflix, Inc. 4 | * 5 | * Licensed under the BSD+Patent License (the "License"); 6 | * you may not use this file except in compliance with the License. 7 | * You may obtain a copy of the License at 8 | * 9 | * https://opensource.org/licenses/BSDplusPatent 10 | * 11 | * Unless required by applicable law or agreed to in writing, software 12 | * distributed under the License is distributed on an "AS IS" BASIS, 13 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | * See the License for the specific language governing permissions and 15 | * limitations under the License. 16 | * 17 | */ 18 | 19 | #ifndef X86_AVX512_MOTION_H_ 20 | #define X86_AVX512_MOTION_H_ 21 | 22 | #include <stdint.h> 23 | 24 | void x_convolution_16_avx512(const uint16_t *src, uint16_t *dst, unsigned width, 25 | unsigned height, ptrdiff_t src_stride, 26 | ptrdiff_t dst_stride); 27 | 28 | #endif /* X86_AVX512_MOTION_H_ */ 29 | -------------------------------------------------------------------------------- /libvmaf/src/feature/x86/vif_avx512.h: -------------------------------------------------------------------------------- 1 | /** 2 | * 3 | * Copyright 2016-2020 Netflix, Inc. 4 | * 5 | * Licensed under the BSD+Patent License (the "License"); 6 | * you may not use this file except in compliance with the License. 7 | * You may obtain a copy of the License at 8 | * 9 | * https://opensource.org/licenses/BSDplusPatent 10 | * 11 | * Unless required by applicable law or agreed to in writing, software 12 | * distributed under the License is distributed on an "AS IS" BASIS, 13 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | * See the License for the specific language governing permissions and 15 | * limitations under the License. 16 | * 17 | */ 18 | 19 | #ifndef X86_AVX512_VIF_H_ 20 | #define X86_AVX512_VIF_H_ 21 | 22 | #include "feature/integer_vif.h" 23 | 24 | void vif_subsample_rd_8_avx512(VifBuffer buf, unsigned w, unsigned h); 25 | 26 | void vif_subsample_rd_16_avx512(VifBuffer buf, unsigned w, unsigned h, int scale, 27 | int bpc); 28 | 29 | void vif_statistic_8_avx512(struct VifPublicState *s, float *num, float *den, unsigned w, unsigned h); 30 | 31 | void vif_statistic_16_avx512(struct VifPublicState *s, float *num, float *den, unsigned w, unsigned h, int bpc, int scale); 32 | 33 | #endif /* X86_AVX512_VIF_H_ */ 34 | -------------------------------------------------------------------------------- /libvmaf/src/log.h: -------------------------------------------------------------------------------- 1 | /** 2 | * 3 | * Copyright 2016-2020 Netflix, Inc. 4 | * 5 | * Licensed under the BSD+Patent License (the "License"); 6 | * you may not use this file except in compliance with the License. 7 | * You may obtain a copy of the License at 8 | * 9 | * https://opensource.org/licenses/BSDplusPatent 10 | * 11 | * Unless required by applicable law or agreed to in writing, software 12 | * distributed under the License is distributed on an "AS IS" BASIS, 13 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | * See the License for the specific language governing permissions and 15 | * limitations under the License. 16 | * 17 | */ 18 | 19 | #ifndef __VMAF_SRC_LOG_H__ 20 | #define __VMAF_SRC_LOG_H__ 21 | 22 | #include "libvmaf/libvmaf.h" 23 | 24 | void vmaf_set_log_level(enum VmafLogLevel log_level); 25 | void vmaf_log(enum VmafLogLevel log_level, const char *fmt, ...); 26 | 27 | #endif /* __VMAF_SRC_LOG_H__ */ 28 | -------------------------------------------------------------------------------- /libvmaf/src/mem.c: -------------------------------------------------------------------------------- 1 | /** 2 | * 3 | * Copyright 2016-2020 Netflix, Inc. 4 | * 5 | * Licensed under the BSD+Patent License (the "License"); 6 | * you may not use this file except in compliance with the License. 7 | * You may obtain a copy of the License at 8 | * 9 | * https://opensource.org/licenses/BSDplusPatent 10 | * 11 | * Unless required by applicable law or agreed to in writing, software 12 | * distributed under the License is distributed on an "AS IS" BASIS, 13 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | * See the License for the specific language governing permissions and 15 | * limitations under the License. 16 | * 17 | */ 18 | 19 | #define _POSIX_C_SOURCE 200112L 20 | 21 | #include <stddef.h> 22 | #include <stdlib.h> 23 | #include "mem.h" 24 | 25 | void *aligned_malloc(size_t size, size_t alignment) 26 | { 27 | void *ptr; 28 | 29 | #if defined(_MSC_VER) || defined(__MINGW32__) 30 | if ((ptr = _aligned_malloc(size, alignment)) == NULL) 31 | #else 32 | if (posix_memalign(&ptr, alignment, size)) 33 | #endif 34 | return 0; 35 | else 36 | return ptr; 37 | } 38 | 39 | void aligned_free(void *ptr) 40 | { 41 | #if defined(_MSC_VER) || defined(__MINGW32__) 42 | _aligned_free(ptr); 43 | #else 44 | free(ptr); 45 | #endif 46 | } 47 | -------------------------------------------------------------------------------- /libvmaf/src/mem.h: -------------------------------------------------------------------------------- 1 | /** 2 | * 3 | * Copyright 2016-2020 Netflix, Inc. 4 | * 5 | * Licensed under the BSD+Patent License (the "License"); 6 | * you may not use this file except in compliance with the License. 7 | * You may obtain a copy of the License at 8 | * 9 | * https://opensource.org/licenses/BSDplusPatent 10 | * 11 | * Unless required by applicable law or agreed to in writing, software 12 | * distributed under the License is distributed on an "AS IS" BASIS, 13 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | * See the License for the specific language governing permissions and 15 | * limitations under the License. 16 | * 17 | */ 18 | 19 | #ifndef __VMAF_MEM_H__ 20 | #define __VMAF_MEM_H__ 21 | 22 | #include <stddef.h> 23 | 24 | #define MAX_ALIGN 32 25 | 26 | #define ALIGN_FLOOR(x) ((x) - (x) % MAX_ALIGN) 27 | #define ALIGN_CEIL(x) ((x) + ((x) % MAX_ALIGN ? MAX_ALIGN - (x) % MAX_ALIGN : 0)) 28 | 29 | void *aligned_malloc(size_t size, size_t alignment); 30 | 31 | void aligned_free(void *ptr); 32 | 33 | #endif /* __VMAF_MEM_H__ */ 34 | -------------------------------------------------------------------------------- /libvmaf/src/ref.h: -------------------------------------------------------------------------------- 1 | /** 2 | * 3 | * Copyright 2016-2020 Netflix, Inc. 4 | * 5 | * Licensed under the BSD+Patent License (the "License"); 6 | * you may not use this file except in compliance with the License. 7 | * You may obtain a copy of the License at 8 | * 9 | * https://opensource.org/licenses/BSDplusPatent 10 | * 11 | * Unless required by applicable law or agreed to in writing, software 12 | * distributed under the License is distributed on an "AS IS" BASIS, 13 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | * See the License for the specific language governing permissions and 15 | * limitations under the License. 16 | * 17 | */ 18 | 19 | #ifndef __VMAF_SRC_REF_H__ 20 | #define __VMAF_SRC_REF_H__ 21 | 22 | #include <stdatomic.h> 23 | 24 | typedef struct VmafRef { 25 | atomic_int cnt; 26 | } VmafRef; 27 | 28 | int vmaf_ref_init(VmafRef **ref); 29 | void vmaf_ref_fetch_increment(VmafRef *ref); 30 | long vmaf_ref_fetch_decrement(VmafRef *ref); 31 | long vmaf_ref_load(VmafRef *ref); 32 | int vmaf_ref_close(VmafRef *ref); 33 | 34 | #endif /* __VMAF_SRC_REF_H__ */ 35 | -------------------------------------------------------------------------------- /libvmaf/src/thread_pool.h: -------------------------------------------------------------------------------- 1 | /** 2 | * 3 | * Copyright 2016-2020 Netflix, Inc. 4 | * 5 | * Licensed under the BSD+Patent License (the "License"); 6 | * you may not use this file except in compliance with the License. 7 | * You may obtain a copy of the License at 8 | * 9 | * https://opensource.org/licenses/BSDplusPatent 10 | * 11 | * Unless required by applicable law or agreed to in writing, software 12 | * distributed under the License is distributed on an "AS IS" BASIS, 13 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | * See the License for the specific language governing permissions and 15 | * limitations under the License. 16 | * 17 | */ 18 | 19 | #ifndef __VMAF_THREAD_POOL_H__ 20 | #define __VMAF_THREAD_POOL_H__ 21 | 22 | #include <pthread.h> 23 | 24 | typedef struct VmafThreadPool VmafThreadPool; 25 | 26 | int vmaf_thread_pool_create(VmafThreadPool **tpool, unsigned n_threads); 27 | 28 | int vmaf_thread_pool_enqueue(VmafThreadPool *pool, void (*func)(void *data), 29 | void *data, size_t data_sz); 30 | 31 | int vmaf_thread_pool_wait(VmafThreadPool *pool); 32 | 33 | int vmaf_thread_pool_destroy(VmafThreadPool *tpool); 34 | 35 | #endif /* __VMAF_THREAD_POOL_H__ */ 36 | -------------------------------------------------------------------------------- /libvmaf/src/x86/cpu.h: -------------------------------------------------------------------------------- 1 | /** 2 | * 3 | * Copyright 2016-2020 Netflix, Inc. 4 | * 5 | * Licensed under the BSD+Patent License (the "License"); 6 | * you may not use this file except in compliance with the License. 7 | * You may obtain a copy of the License at 8 | * 9 | * https://opensource.org/licenses/BSDplusPatent 10 | * 11 | * Unless required by applicable law or agreed to in writing, software 12 | * distributed under the License is distributed on an "AS IS" BASIS, 13 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | * See the License for the specific language governing permissions and 15 | * limitations under the License. 16 | * 17 | */ 18 | 19 | #ifndef __VMAF_SRC_X86_CPU_H__ 20 | #define __VMAF_SRC_X86_CPU_H__ 21 | 22 | enum VmafCpuFlags { 23 | VMAF_X86_CPU_FLAG_SSE2 = 1 << 0, 24 | VMAF_X86_CPU_FLAG_SSSE3 = 1 << 1, 25 | VMAF_X86_CPU_FLAG_SSE41 = 1 << 2, 26 | VMAF_X86_CPU_FLAG_AVX2 = 1 << 3, 27 | VMAF_X86_CPU_FLAG_AVX512 = 1 << 4, 28 | VMAF_X86_CPU_FLAG_AVX512ICL = 1 << 5, 29 | }; 30 | 31 | unsigned vmaf_get_cpu_flags_x86(void); 32 | 33 | #endif /* __VMAF_SRC_X86_CPU_H__ */ 34 | -------------------------------------------------------------------------------- /libvmaf/test/test.c: -------------------------------------------------------------------------------- 1 | /** 2 | * 3 | * Copyright 2016-2020 Netflix, Inc. 4 | * 5 | * Licensed under the BSD+Patent License (the "License"); 6 | * you may not use this file except in compliance with the License. 7 | * You may obtain a copy of the License at 8 | * 9 | * https://opensource.org/licenses/BSDplusPatent 10 | * 11 | * Unless required by applicable law or agreed to in writing, software 12 | * distributed under the License is distributed on an "AS IS" BASIS, 13 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | * See the License for the specific language governing permissions and 15 | * limitations under the License. 16 | * 17 | */ 18 | 19 | #include "test.h" 20 | #include <stdio.h> 21 | 22 | int mu_tests_run; 23 | 24 | int main(void) 25 | { 26 | char *msg = run_tests(); 27 | 28 | if (msg) 29 | fprintf(stderr, "\033[31m, %s\n%d tests run, 1 failed\033[0m\n", msg, mu_tests_run); 30 | else 31 | fprintf(stderr, "\033[32m%d tests run, %d passed\033[0m\n", mu_tests_run, mu_tests_run); 32 | 33 | return msg != 0; 34 | } 35 | -------------------------------------------------------------------------------- /libvmaf/tools/meson.build: -------------------------------------------------------------------------------- 1 | compat_cflags = [] 2 | if cc.has_function('strsep') 3 | compat_cflags += '-DHAVE_STRSEP' 4 | endif 5 | 6 | vmaf = executable( 7 | 'vmaf', 8 | ['vmaf.c', 'cli_parse.c', 'y4m_input.c', 'vidinput.c', 'yuv_input.c'], 9 | include_directories : [libvmaf_inc, vmaf_include], 10 | dependencies: [stdatomic_dependency, cuda_dependency], 11 | c_args : [vmaf_cflags_common, compat_cflags], 12 | link_with : get_option('default_library') == 'both' ? libvmaf.get_static_lib() : libvmaf, 13 | install : true, 14 | ) 15 | 16 | subdir('test') 17 | -------------------------------------------------------------------------------- /libvmaf/tools/spinner.h: -------------------------------------------------------------------------------- 1 | const char *spinner[] = { 2 | "⢀⠀","⡀⠀","⠄⠀","⢂⠀","⡂⠀","⠅⠀","⢃⠀","⡃⠀","⠍⠀","⢋⠀","⡋⠀","⠍⠁","⢋⠁","⡋⠁","⠍⠉", 3 | "⠋⠉","⠋⠉","⠉⠙","⠉⠙","⠉⠩","⠈⢙","⠈⡙","⢈⠩","⡀⢙","⠄⡙","⢂⠩","⡂⢘","⠅⡘","⢃⠨","⡃⢐", 4 | "⠍⡐","⢋⠠","⡋⢀","⠍⡁","⢋⠁","⡋⠁","⠍⠉","⠋⠉","⠋⠉","⠉⠙","⠉⠙","⠉⠩","⠈⢙","⠈⡙","⠈⠩", 5 | "⠀⢙","⠀⡙","⠀⠩","⠀⢘","⠀⡘","⠀⠨","⠀⢐","⠀⡐","⠀⠠","⠀⢀","⠀⡀" 6 | }; 7 | 8 | const unsigned spinner_length = sizeof(spinner) / sizeof(spinner[0]); 9 | -------------------------------------------------------------------------------- /libvmaf/tools/test/meson.build: -------------------------------------------------------------------------------- 1 | if get_option('enable_cuda') 2 | test_vmaf_cuda_gpumask = find_program('test_vmaf_cuda_gpumask.sh') 3 | test('test_vmaf_cuda_gpumask', test_vmaf_cuda_gpumask) 4 | endif 5 | -------------------------------------------------------------------------------- /libvmaf/tools/test/test_vmaf_cuda_gpumask.sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh -x 2 | set -e 3 | 4 | # no gpumask: use cuda 5 | ./tools/vmaf \ 6 | --reference /dev/zero \ 7 | --distorted /dev/zero \ 8 | --width 1920 --height 1080 --pixel_format 420 --bitdepth 8 \ 9 | --frame_cnt 2 \ 10 | --gpumask 0 11 | 12 | # gpumask: use cpu 13 | ./tools/vmaf \ 14 | --reference /dev/zero \ 15 | --distorted /dev/zero \ 16 | --width 1920 --height 1080 --pixel_format 420 --bitdepth 8 \ 17 | --frame_cnt 2 \ 18 | --gpumask -1 19 | 20 | # no gpumask: use cuda for vmaf features, cpu for psnr 21 | ./tools/vmaf \ 22 | --reference /dev/zero \ 23 | --distorted /dev/zero \ 24 | --width 1920 --height 1080 --pixel_format 420 --bitdepth 8 \ 25 | --frame_cnt 2 \ 26 | --gpumask 0 \ 27 | --feature psnr \ 28 | --output /dev/stdout 29 | 30 | # gpumask: use cpu for vmaf features and psnr 31 | ./tools/vmaf \ 32 | --reference /dev/zero \ 33 | --distorted /dev/zero \ 34 | --width 1920 --height 1080 --pixel_format 420 --bitdepth 8 \ 35 | --frame_cnt 2 \ 36 | --gpumask -1 \ 37 | --feature psnr 38 | -------------------------------------------------------------------------------- /matlab/.gitignore: -------------------------------------------------------------------------------- 1 | *~ -------------------------------------------------------------------------------- /matlab/STMAD_2011_MatlabCode/Example.m: -------------------------------------------------------------------------------- 1 | clc; 2 | clear; 3 | close all; 4 | 5 | Hei = 324; 6 | Wid = 576; 7 | OrgFile = '../../python/test/resource/yuv/src01_hrc00_576x324.yuv'; 8 | DstFile = '../../python/test/resource/yuv/src01_hrc01_576x324.yuv'; 9 | 10 | run_stmad(OrgFile, DstFile, Wid, Hei); 11 | -------------------------------------------------------------------------------- /matlab/STMAD_2011_MatlabCode/STMAD_index.m: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Netflix/vmaf/b9ac69e6c4231fad0465021f9e31a841a18261db/matlab/STMAD_2011_MatlabCode/STMAD_index.m -------------------------------------------------------------------------------- /matlab/STMAD_2011_MatlabCode/calcSMADScore.m: -------------------------------------------------------------------------------- 1 | function calcSMADScore(rname,dname,colms,rows) 2 | 3 | rfid = fopen(rname); 4 | dfid = fopen(dname); 5 | 6 | iframe = 0; 7 | while 1 8 | 9 | [yr,~,~] = readframefromfid(rfid,rows,colms); 10 | [yd,~,~] = readframefromfid(dfid,rows,colms); 11 | 12 | if feof(rfid) || feof(dfid) 13 | break; 14 | end 15 | 16 | % read successful, can then reshape 17 | OrgImg = reshape(yr,[colms rows])'; 18 | DstImg = reshape(yd,[colms rows])'; 19 | 20 | HiIndex = hi_index(OrgImg, DstImg); 21 | LoIndex = lo_index(OrgImg, DstImg); 22 | 23 | disp(sprintf('HiIndex: %d %f', iframe, HiIndex)); 24 | disp(sprintf('LoIndex: %d %f', iframe, LoIndex)); 25 | 26 | iframe = iframe+1; 27 | 28 | end 29 | 30 | % repeat reading for last frame 31 | % disp(sprintf('HiIndex: %d %f', iframe, HiIndex)); 32 | % disp(sprintf('LoIndex: %d %f', iframe, LoIndex)); 33 | 34 | fclose(rfid); 35 | fclose(dfid); 36 | 37 | end 38 | 39 | -------------------------------------------------------------------------------- /matlab/STMAD_2011_MatlabCode/calculateSMADScore.m: -------------------------------------------------------------------------------- 1 | function calcSMADScore(rname,dname,rows,colms) 2 | 3 | rfid = fopen(rname); 4 | dfid = fopen(dname); 5 | 6 | iframe = -1; 7 | while 1 8 | 9 | [yr,cbr,crr] = readframefromfid(rfid,rows,colms); 10 | [yd,cbr,crr] = readframefromfid(dfid,rows,colms); 11 | 12 | if feof(rfid) || feof(dfid) 13 | break; 14 | end 15 | 16 | % read successful, can then reshape 17 | OrgImg = reshape(yr,rows,colms)'; 18 | DstImg = reshape(yd,rows,colms)'; 19 | 20 | HiIndex = hi_index(OrgImg, DstImg); 21 | LoIndex = lo_index(OrgImg, DstImg); 22 | 23 | disp(sprintf('HiIndex: %d %f', iframe, HiIndex)); 24 | disp(sprintf('LoIndex: %d %f', iframe, LoIndex)); 25 | 26 | iframe = iframe+1; 27 | 28 | end 29 | 30 | % repeat reading for last frame 31 | disp(sprintf('HiIndex: %d %f', iframe, HiIndex)); 32 | disp(sprintf('LoIndex: %d %f', iframe, LoIndex)); 33 | 34 | fclose(rfid); 35 | fclose(dfid); 36 | 37 | end 38 | 39 | -------------------------------------------------------------------------------- /matlab/STMAD_2011_MatlabCode/ical_stat.mexa64: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Netflix/vmaf/b9ac69e6c4231fad0465021f9e31a841a18261db/matlab/STMAD_2011_MatlabCode/ical_stat.mexa64 -------------------------------------------------------------------------------- /matlab/STMAD_2011_MatlabCode/ical_stat.mexmaci64: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Netflix/vmaf/b9ac69e6c4231fad0465021f9e31a841a18261db/matlab/STMAD_2011_MatlabCode/ical_stat.mexmaci64 -------------------------------------------------------------------------------- /matlab/STMAD_2011_MatlabCode/ical_stat.mexw64: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Netflix/vmaf/b9ac69e6c4231fad0465021f9e31a841a18261db/matlab/STMAD_2011_MatlabCode/ical_stat.mexw64 -------------------------------------------------------------------------------- /matlab/STMAD_2011_MatlabCode/ical_std.mexa64: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Netflix/vmaf/b9ac69e6c4231fad0465021f9e31a841a18261db/matlab/STMAD_2011_MatlabCode/ical_std.mexa64 -------------------------------------------------------------------------------- /matlab/STMAD_2011_MatlabCode/ical_std.mexmaci64: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Netflix/vmaf/b9ac69e6c4231fad0465021f9e31a841a18261db/matlab/STMAD_2011_MatlabCode/ical_std.mexmaci64 -------------------------------------------------------------------------------- /matlab/STMAD_2011_MatlabCode/ical_std.mexw64: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Netflix/vmaf/b9ac69e6c4231fad0465021f9e31a841a18261db/matlab/STMAD_2011_MatlabCode/ical_std.mexw64 -------------------------------------------------------------------------------- /matlab/STMAD_2011_MatlabCode/readframefromfid.m: -------------------------------------------------------------------------------- 1 | function [y,cb,cr]=readframefromfid(fid,height,width) 2 | 3 | % for now, read yuv420p only 4 | 5 | y=fread(fid,width*height, 'uchar')'; 6 | cb=fread(fid,width*height/4, 'uchar')'; 7 | cr=fread(fid,width*height/4, 'uchar')'; 8 | 9 | end -------------------------------------------------------------------------------- /matlab/STMAD_2011_MatlabCode/run_smad.m: -------------------------------------------------------------------------------- 1 | function run_smad(ref_filename, dis_filename, width, height) 2 | 3 | path(path,'./STMAD_2011_MatlabCode'); 4 | 5 | calcSMADScore(ref_filename, dis_filename, width, height); 6 | 7 | % dmos_score = rred2dmos(strred_score) 8 | 9 | end 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | -------------------------------------------------------------------------------- /matlab/STMAD_2011_MatlabCode/run_stmad.m: -------------------------------------------------------------------------------- 1 | function run_stmad(ref_filename, dis_filename, width, height) 2 | 3 | path(path,'./STMAD_2011_MatlabCode'); 4 | 5 | calcSTMADScore(ref_filename, dis_filename, width, height); 6 | 7 | % dmos_score = rred2dmos(strred_score) 8 | 9 | end 10 | -------------------------------------------------------------------------------- /matlab/SpEED/run_speed.m: -------------------------------------------------------------------------------- 1 | function run_speed(ref_filename, dis_filename, width, height, bands, yuv_type) 2 | %RUN_SPEED Summary of this function goes here 3 | % Detailed explanation goes here 4 | 5 | path(path,'./SpEED'); 6 | calcSpEEDScore(ref_filename, dis_filename, width, height, bands, yuv_type) 7 | end 8 | 9 | 10 | 11 | 12 | -------------------------------------------------------------------------------- /matlab/cid_icid/BT709_f.mat: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Netflix/vmaf/b9ac69e6c4231fad0465021f9e31a841a18261db/matlab/cid_icid/BT709_f.mat -------------------------------------------------------------------------------- /matlab/cid_icid/BT709_l.mat: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Netflix/vmaf/b9ac69e6c4231fad0465021f9e31a841a18261db/matlab/cid_icid/BT709_l.mat -------------------------------------------------------------------------------- /matlab/cid_icid/iCID/iCID_Metric/ColorSpaceTransformations/FilterImageCSF.m: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Netflix/vmaf/b9ac69e6c4231fad0465021f9e31a841a18261db/matlab/cid_icid/iCID/iCID_Metric/ColorSpaceTransformations/FilterImageCSF.m -------------------------------------------------------------------------------- /matlab/cid_icid/iCID/iCID_Metric/ColorSpaceTransformations/ImageSRGB2XYZ.m: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Netflix/vmaf/b9ac69e6c4231fad0465021f9e31a841a18261db/matlab/cid_icid/iCID/iCID_Metric/ColorSpaceTransformations/ImageSRGB2XYZ.m -------------------------------------------------------------------------------- /matlab/cid_icid/iCID/iCID_Metric/ColorSpaceTransformations/ImageXYZ2LAB2000HL.m: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Netflix/vmaf/b9ac69e6c4231fad0465021f9e31a841a18261db/matlab/cid_icid/iCID/iCID_Metric/ColorSpaceTransformations/ImageXYZ2LAB2000HL.m -------------------------------------------------------------------------------- /matlab/cid_icid/iCID/iCID_Metric/ColorSpaceTransformations/LAB2000HL.mat: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Netflix/vmaf/b9ac69e6c4231fad0465021f9e31a841a18261db/matlab/cid_icid/iCID/iCID_Metric/ColorSpaceTransformations/LAB2000HL.mat -------------------------------------------------------------------------------- /matlab/cid_icid/iCID/iCID_Metric/ColorSpaceTransformations/LAB2LAB2000HL.m: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Netflix/vmaf/b9ac69e6c4231fad0465021f9e31a841a18261db/matlab/cid_icid/iCID/iCID_Metric/ColorSpaceTransformations/LAB2LAB2000HL.m -------------------------------------------------------------------------------- /matlab/cid_icid/iCID/iCID_Metric/ColorSpaceTransformations/SRGB2XYZ.m: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Netflix/vmaf/b9ac69e6c4231fad0465021f9e31a841a18261db/matlab/cid_icid/iCID/iCID_Metric/ColorSpaceTransformations/SRGB2XYZ.m -------------------------------------------------------------------------------- /matlab/cid_icid/iCID/iCID_Metric/ColorSpaceTransformations/XYZ2LAB.m: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Netflix/vmaf/b9ac69e6c4231fad0465021f9e31a841a18261db/matlab/cid_icid/iCID/iCID_Metric/ColorSpaceTransformations/XYZ2LAB.m -------------------------------------------------------------------------------- /matlab/cid_icid/iCID/iCID_Metric/ColorSpaceTransformations/colorspace.m: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Netflix/vmaf/b9ac69e6c4231fad0465021f9e31a841a18261db/matlab/cid_icid/iCID/iCID_Metric/ColorSpaceTransformations/colorspace.m -------------------------------------------------------------------------------- /matlab/cid_icid/iCID/iCID_Metric/README.txt: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Netflix/vmaf/b9ac69e6c4231fad0465021f9e31a841a18261db/matlab/cid_icid/iCID/iCID_Metric/README.txt -------------------------------------------------------------------------------- /matlab/cid_icid/iCID/iCID_Metric/iCID.m: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Netflix/vmaf/b9ac69e6c4231fad0465021f9e31a841a18261db/matlab/cid_icid/iCID/iCID_Metric/iCID.m -------------------------------------------------------------------------------- /matlab/cid_icid/run_icid.m: -------------------------------------------------------------------------------- 1 | function run_icid(ref_filename, dis_filename, width, height, yuv_type) 2 | 3 | path(path,'./iCID/iCID_Metric'); 4 | path(path,'./iCID/iCID_Metric/ColorSpaceTransformations'); 5 | 6 | yuv_ref = yuvread(ref_filename,width,height,yuv_type,1); 7 | yuv_dis = yuvread(dis_filename,width,height,yuv_type,1); 8 | 9 | len = min(length(yuv_ref), length(yuv_dis)); 10 | 11 | result = zeros(1,len); 12 | 13 | for idx = 1:len 14 | OrgImg = yuv_ref(idx).cdata; 15 | DstImg = yuv_dis(idx).cdata; 16 | OrgImg = yuv2rgb(OrgImg(:,:,1), OrgImg(:,:,2), OrgImg(:,:,3),'YUV444_8'); 17 | DstImg = yuv2rgb(DstImg(:,:,1), DstImg(:,:,2), DstImg(:,:,3),'YUV444_8'); 18 | [result(idx), ~] = iCID(OrgImg, DstImg); 19 | end 20 | 21 | 22 | for frame_ind = 0 : len - 1 23 | disp(sprintf('icid: %d %f', frame_ind, result(frame_ind + 1))); 24 | end; 25 | 26 | end 27 | -------------------------------------------------------------------------------- /matlab/strred/README: -------------------------------------------------------------------------------- 1 | ** modifications ** 2 | 3 | (12/19/2016 zli@netflix.com) Three modifications are made to fit into the VDK framework: 4 | 1) Instead of specifying number of seconds to read, read file until the end. 5 | 2) Instead of calculating a frame score every two frames, change it to one score 6 | every frame. 7 | 3) Original algorithm averages frame SRRED and TRRED scores first, and the final 8 | STRRED score is the product of the two. In this modified version, only the per- 9 | frame SRRED and TRRED scores are calculated and passed out. The computation of 10 | the STRRED score is performed outside, by first computing the per-frame STRRED 11 | score via: 12 | per-frame STRRED = (per-frame SRRED) * (per-frame TRRED) 13 | and then aggregating (e.g. via taking the mean). 14 | 15 | ** run ** 16 | 17 | Command run_strred takes in arguments: 18 | ref_yuv_file_path dis_yuv_file_path width height 19 | 20 | After installing Matlab and setting path, run STRRED in command line: 21 | matlab -nodisplay -nosplash -nodesktop -r "run_strred('../../python/test/resource/yuv/src01_hrc00_576x324.yuv', '../../python/test/resource/yuv/src01_hrc01_576x324.yuv', 576, 324); exit;" 22 | 23 | 24 | -------------------------------------------------------------------------------- /matlab/strred/matlabPyrTools/MEX/-MacReadMe: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Netflix/vmaf/b9ac69e6c4231fad0465021f9e31a841a18261db/matlab/strred/matlabPyrTools/MEX/-MacReadMe -------------------------------------------------------------------------------- /matlab/strred/matlabPyrTools/MEX/.AppleDouble/.Parent: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Netflix/vmaf/b9ac69e6c4231fad0465021f9e31a841a18261db/matlab/strred/matlabPyrTools/MEX/.AppleDouble/.Parent -------------------------------------------------------------------------------- /matlab/strred/matlabPyrTools/MEX/.FBCIndex: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Netflix/vmaf/b9ac69e6c4231fad0465021f9e31a841a18261db/matlab/strred/matlabPyrTools/MEX/.FBCIndex -------------------------------------------------------------------------------- /matlab/strred/matlabPyrTools/MEX/.FBCLockFolder/.FBCSemaphoreFile: -------------------------------------------------------------------------------- 1 | ������ -------------------------------------------------------------------------------- /matlab/strred/matlabPyrTools/MEX/Copy_of_corrDn.mexmac: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Netflix/vmaf/b9ac69e6c4231fad0465021f9e31a841a18261db/matlab/strred/matlabPyrTools/MEX/Copy_of_corrDn.mexmac -------------------------------------------------------------------------------- /matlab/strred/matlabPyrTools/MEX/Makefile-linux: -------------------------------------------------------------------------------- 1 | MLAB = /usr/local/matlab5.1 2 | 3 | MXSFX = mexlx 4 | MEX = ${MLAB}/bin/mex 5 | 6 | MFLAGS = -V4 7 | INC = -I ${MLAB}/extern/include 8 | LIB = -L ${MLAB}/extern/lib 9 | 10 | CC = gcc -Wall -pedantic 11 | C_OPTIMIZE_SWITCH = -O2 ## For GCC 12 | CFLAGS = ${C_OPTIMIZE_SWITCH} ${INC} ${LIB} 13 | 14 | all: corrDn.${MXSFX} upConv.${MXSFX} pointOp.${MXSFX} \ 15 | histo.${MXSFX} range2.${MXSFX} 16 | 17 | clean: 18 | /bin/rm *.o 19 | 20 | corrDn.${MXSFX}: corrDn.o wrap.o convolve.o edges.o 21 | ${MEX} ${MFLAGS} corrDn.o wrap.o convolve.o edges.o 22 | 23 | upConv.${MXSFX}: upConv.o wrap.o convolve.o edges.o 24 | ${MEX} ${MFLAGS} upConv.o wrap.o convolve.o edges.o 25 | 26 | pointOp.${MXSFX}: pointOp.o 27 | ${MEX} ${MFLAGS} pointOp.o 28 | 29 | histo.${MXSFX}: histo.o 30 | ${MEX} ${MFLAGS} histo.o 31 | 32 | range2.${MXSFX}: range2.o 33 | ${MEX} ${MFLAGS} range2.o 34 | 35 | convolve.o wrap.o edges.o: convolve.h 36 | 37 | %.o : %.c 38 | ${CC} -c ${CFLAGS} lt; 39 | 40 | -------------------------------------------------------------------------------- /matlab/strred/matlabPyrTools/MEX/Makefile-ml6-linux: -------------------------------------------------------------------------------- 1 | MLAB = /usr/local/matlab6.0 2 | 3 | MXSFX = mexglx 4 | MEX = ${MLAB}/bin/mex 5 | 6 | MFLAGS = -V4 7 | INC = -I ${MLAB}/extern/include 8 | LIB = -L ${MLAB}/extern/lib 9 | 10 | CC = gcc -Wall -pedantic 11 | C_OPTIMIZE_SWITCH = -O2 ## For GCC 12 | CFLAGS = ${C_OPTIMIZE_SWITCH} ${INC} ${LIB} 13 | 14 | all: corrDn.${MXSFX} upConv.${MXSFX} pointOp.${MXSFX} \ 15 | histo.${MXSFX} range2.${MXSFX} 16 | 17 | clean: 18 | /bin/rm *.o 19 | 20 | corrDn.${MXSFX}: corrDn.o wrap.o convolve.o edges.o 21 | ${MEX} ${MFLAGS} corrDn.o wrap.o convolve.o edges.o 22 | 23 | upConv.${MXSFX}: upConv.o wrap.o convolve.o edges.o 24 | ${MEX} ${MFLAGS} upConv.o wrap.o convolve.o edges.o 25 | 26 | pointOp.${MXSFX}: pointOp.o 27 | ${MEX} ${MFLAGS} pointOp.o 28 | 29 | histo.${MXSFX}: histo.o 30 | ${MEX} ${MFLAGS} histo.o 31 | 32 | range2.${MXSFX}: range2.o 33 | ${MEX} ${MFLAGS} range2.o 34 | 35 | convolve.o wrap.o edges.o: convolve.h 36 | 37 | %.o : %.c 38 | ${CC} -c ${CFLAGS} lt; 39 | 40 | -------------------------------------------------------------------------------- /matlab/strred/matlabPyrTools/MEX/Makefile-osx: -------------------------------------------------------------------------------- 1 | MLAB = /share/wotan/matlab13 2 | 3 | MXSFX = mexosx 4 | MEX = ${MLAB}/bin/mex 5 | 6 | MFLAGS = 7 | INC = -I ${MLAB}/extern/include 8 | LIB = -L ${MLAB}/extern/lib 9 | 10 | CC = cc -Wall -pedantic -no-cpp-precomp 11 | C_OPTIMIZE_SWITCH = -O2 ## For GCC 12 | CFLAGS = ${C_OPTIMIZE_SWITCH} ${INC} ${LIB} 13 | 14 | all: corrDn.${MXSFX} upConv.${MXSFX} pointOp.${MXSFX} \ 15 | histo.${MXSFX} range2.${MXSFX} 16 | 17 | clean: 18 | /bin/rm *.o 19 | 20 | corrDn.${MXSFX}: corrDn.o wrap.o convolve.o edges.o 21 | ${MEX} ${MFLAGS} corrDn.o wrap.o convolve.o edges.o 22 | 23 | upConv.${MXSFX}: upConv.o wrap.o convolve.o edges.o 24 | ${MEX} ${MFLAGS} upConv.o wrap.o convolve.o edges.o 25 | 26 | pointOp.${MXSFX}: pointOp.o 27 | ${MEX} ${MFLAGS} pointOp.o 28 | 29 | histo.${MXSFX}: histo.o 30 | ${MEX} ${MFLAGS} histo.o 31 | 32 | range2.${MXSFX}: range2.o 33 | ${MEX} ${MFLAGS} range2.o 34 | 35 | convolve.o wrap.o edges.o: convolve.h 36 | 37 | %.o : %.c 38 | ${CC} -c ${CFLAGS} lt; 39 | 40 | -------------------------------------------------------------------------------- /matlab/strred/matlabPyrTools/MEX/Makefile-solaris: -------------------------------------------------------------------------------- 1 | MLAB = /export/home/Solaris2/matlab5.1 2 | 3 | MXSFX = mexsol 4 | MEX = ${MLAB}/bin/mex 5 | 6 | MFLAGS = -V4 7 | INC = -I ${MLAB}/extern/include 8 | LIB = -L ${MLAB}/extern/lib 9 | 10 | CC = gcc -Wall -pedantic 11 | C_OPTIMIZE_SWITCH = -O2 ## For GCC 12 | CFLAGS = ${C_OPTIMIZE_SWITCH} ${INC} ${LIB} 13 | 14 | all: corrDn.${MXSFX} upConv.${MXSFX} pointOp.${MXSFX} \ 15 | histo.${MXSFX} range2.${MXSFX} 16 | 17 | clean: 18 | /bin/rm *.o 19 | 20 | corrDn.${MXSFX}: corrDn.o wrap.o convolve.o edges.o 21 | ${MEX} ${MFLAGS} corrDn.o wrap.o convolve.o edges.o 22 | 23 | upConv.${MXSFX}: upConv.o wrap.o convolve.o edges.o 24 | ${MEX} ${MFLAGS} upConv.o wrap.o convolve.o edges.o 25 | 26 | pointOp.${MXSFX}: pointOp.o 27 | ${MEX} ${MFLAGS} pointOp.o 28 | 29 | histo.${MXSFX}: histo.o 30 | ${MEX} ${MFLAGS} histo.o 31 | 32 | range2.${MXSFX}: range2.o 33 | ${MEX} ${MFLAGS} range2.o 34 | 35 | convolve.o wrap.o edges.o: convolve.h 36 | 37 | %.o : %.c 38 | ${CC} -c ${CFLAGS} lt; 39 | -------------------------------------------------------------------------------- /matlab/strred/matlabPyrTools/MEX/Makefile-sun4: -------------------------------------------------------------------------------- 1 | MLAB = /home/alberich/matlab4 2 | 3 | MXSFX = mex4 4 | MEX = ${MLAB}/bin/cmex 5 | 6 | MFLAGS = 7 | INC = -I ${MLAB}/extern/include 8 | LIB = -L ${MLAB}/extern/lib/sun4 9 | 10 | CC = gcc 11 | C_OPTIMIZE_SWITCH = -O2 ## For GCC 12 | CFLAGS = ${C_OPTIMIZE_SWITCH} ${INC} ${LIB} 13 | 14 | all: corrDn.${MXSFX} upConv.${MXSFX} pointOp.${MXSFX} \ 15 | histo.${MXSFX} range2.${MXSFX} 16 | 17 | clean: 18 | /bin/rm *.o 19 | 20 | corrDn.${MXSFX}: corrDn.o wrap.o convolve.o edges.o 21 | ${MEX} ${MFLAGS} corrDn.o wrap.o convolve.o edges.o 22 | 23 | upConv.${MXSFX}: upConv.o wrap.o convolve.o edges.o 24 | ${MEX} ${MFLAGS} upConv.o wrap.o convolve.o edges.o 25 | 26 | pointOp.${MXSFX}: pointOp.o 27 | ${MEX} ${MFLAGS} pointOp.o 28 | 29 | histo.${MXSFX}: histo.o 30 | ${MEX} ${MFLAGS} histo.o 31 | 32 | range2.${MXSFX}: range2.o 33 | ${MEX} ${MFLAGS} range2.o 34 | 35 | convolve.o wrap.o edges.o: convolve.h 36 | 37 | %.o : %.c 38 | ${CC} -c ${CFLAGS} lt; 39 | 40 | -------------------------------------------------------------------------------- /matlab/strred/matlabPyrTools/MEX/corrDn.dll: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Netflix/vmaf/b9ac69e6c4231fad0465021f9e31a841a18261db/matlab/strred/matlabPyrTools/MEX/corrDn.dll -------------------------------------------------------------------------------- /matlab/strred/matlabPyrTools/MEX/corrDn.exp: -------------------------------------------------------------------------------- 1 | corrDn.mexw32 2 | _mexFunction _mexFunction 3 | -------------------------------------------------------------------------------- /matlab/strred/matlabPyrTools/MEX/corrDn.lib: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Netflix/vmaf/b9ac69e6c4231fad0465021f9e31a841a18261db/matlab/strred/matlabPyrTools/MEX/corrDn.lib -------------------------------------------------------------------------------- /matlab/strred/matlabPyrTools/MEX/corrDn.mex: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Netflix/vmaf/b9ac69e6c4231fad0465021f9e31a841a18261db/matlab/strred/matlabPyrTools/MEX/corrDn.mex -------------------------------------------------------------------------------- /matlab/strred/matlabPyrTools/MEX/corrDn.mex4: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Netflix/vmaf/b9ac69e6c4231fad0465021f9e31a841a18261db/matlab/strred/matlabPyrTools/MEX/corrDn.mex4 -------------------------------------------------------------------------------- /matlab/strred/matlabPyrTools/MEX/corrDn.mexa64: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Netflix/vmaf/b9ac69e6c4231fad0465021f9e31a841a18261db/matlab/strred/matlabPyrTools/MEX/corrDn.mexa64 -------------------------------------------------------------------------------- /matlab/strred/matlabPyrTools/MEX/corrDn.mexglx: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Netflix/vmaf/b9ac69e6c4231fad0465021f9e31a841a18261db/matlab/strred/matlabPyrTools/MEX/corrDn.mexglx -------------------------------------------------------------------------------- /matlab/strred/matlabPyrTools/MEX/corrDn.mexlx: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Netflix/vmaf/b9ac69e6c4231fad0465021f9e31a841a18261db/matlab/strred/matlabPyrTools/MEX/corrDn.mexlx -------------------------------------------------------------------------------- /matlab/strred/matlabPyrTools/MEX/corrDn.mexmac: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Netflix/vmaf/b9ac69e6c4231fad0465021f9e31a841a18261db/matlab/strred/matlabPyrTools/MEX/corrDn.mexmac -------------------------------------------------------------------------------- /matlab/strred/matlabPyrTools/MEX/corrDn.mexsol: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Netflix/vmaf/b9ac69e6c4231fad0465021f9e31a841a18261db/matlab/strred/matlabPyrTools/MEX/corrDn.mexsol -------------------------------------------------------------------------------- /matlab/strred/matlabPyrTools/MEX/corrDn.mexw32: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Netflix/vmaf/b9ac69e6c4231fad0465021f9e31a841a18261db/matlab/strred/matlabPyrTools/MEX/corrDn.mexw32 -------------------------------------------------------------------------------- /matlab/strred/matlabPyrTools/MEX/histo.dll: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Netflix/vmaf/b9ac69e6c4231fad0465021f9e31a841a18261db/matlab/strred/matlabPyrTools/MEX/histo.dll -------------------------------------------------------------------------------- /matlab/strred/matlabPyrTools/MEX/histo.mex: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Netflix/vmaf/b9ac69e6c4231fad0465021f9e31a841a18261db/matlab/strred/matlabPyrTools/MEX/histo.mex -------------------------------------------------------------------------------- /matlab/strred/matlabPyrTools/MEX/histo.mex4: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Netflix/vmaf/b9ac69e6c4231fad0465021f9e31a841a18261db/matlab/strred/matlabPyrTools/MEX/histo.mex4 -------------------------------------------------------------------------------- /matlab/strred/matlabPyrTools/MEX/histo.mexglx: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Netflix/vmaf/b9ac69e6c4231fad0465021f9e31a841a18261db/matlab/strred/matlabPyrTools/MEX/histo.mexglx -------------------------------------------------------------------------------- /matlab/strred/matlabPyrTools/MEX/histo.mexlx: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Netflix/vmaf/b9ac69e6c4231fad0465021f9e31a841a18261db/matlab/strred/matlabPyrTools/MEX/histo.mexlx -------------------------------------------------------------------------------- /matlab/strred/matlabPyrTools/MEX/histo.mexmac: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Netflix/vmaf/b9ac69e6c4231fad0465021f9e31a841a18261db/matlab/strred/matlabPyrTools/MEX/histo.mexmac -------------------------------------------------------------------------------- /matlab/strred/matlabPyrTools/MEX/histo.mexsol: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Netflix/vmaf/b9ac69e6c4231fad0465021f9e31a841a18261db/matlab/strred/matlabPyrTools/MEX/histo.mexsol -------------------------------------------------------------------------------- /matlab/strred/matlabPyrTools/MEX/innerProd.dll: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Netflix/vmaf/b9ac69e6c4231fad0465021f9e31a841a18261db/matlab/strred/matlabPyrTools/MEX/innerProd.dll -------------------------------------------------------------------------------- /matlab/strred/matlabPyrTools/MEX/innerProd.mexglx: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Netflix/vmaf/b9ac69e6c4231fad0465021f9e31a841a18261db/matlab/strred/matlabPyrTools/MEX/innerProd.mexglx -------------------------------------------------------------------------------- /matlab/strred/matlabPyrTools/MEX/innerProd.mexlx: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Netflix/vmaf/b9ac69e6c4231fad0465021f9e31a841a18261db/matlab/strred/matlabPyrTools/MEX/innerProd.mexlx -------------------------------------------------------------------------------- /matlab/strred/matlabPyrTools/MEX/innerProd.mexmac: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Netflix/vmaf/b9ac69e6c4231fad0465021f9e31a841a18261db/matlab/strred/matlabPyrTools/MEX/innerProd.mexmac -------------------------------------------------------------------------------- /matlab/strred/matlabPyrTools/MEX/innerProd.mexsol: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Netflix/vmaf/b9ac69e6c4231fad0465021f9e31a841a18261db/matlab/strred/matlabPyrTools/MEX/innerProd.mexsol -------------------------------------------------------------------------------- /matlab/strred/matlabPyrTools/MEX/pointOp.dll: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Netflix/vmaf/b9ac69e6c4231fad0465021f9e31a841a18261db/matlab/strred/matlabPyrTools/MEX/pointOp.dll -------------------------------------------------------------------------------- /matlab/strred/matlabPyrTools/MEX/pointOp.mex: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Netflix/vmaf/b9ac69e6c4231fad0465021f9e31a841a18261db/matlab/strred/matlabPyrTools/MEX/pointOp.mex -------------------------------------------------------------------------------- /matlab/strred/matlabPyrTools/MEX/pointOp.mex4: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Netflix/vmaf/b9ac69e6c4231fad0465021f9e31a841a18261db/matlab/strred/matlabPyrTools/MEX/pointOp.mex4 -------------------------------------------------------------------------------- /matlab/strred/matlabPyrTools/MEX/pointOp.mexglx: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Netflix/vmaf/b9ac69e6c4231fad0465021f9e31a841a18261db/matlab/strred/matlabPyrTools/MEX/pointOp.mexglx -------------------------------------------------------------------------------- /matlab/strred/matlabPyrTools/MEX/pointOp.mexlx: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Netflix/vmaf/b9ac69e6c4231fad0465021f9e31a841a18261db/matlab/strred/matlabPyrTools/MEX/pointOp.mexlx -------------------------------------------------------------------------------- /matlab/strred/matlabPyrTools/MEX/pointOp.mexmac: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Netflix/vmaf/b9ac69e6c4231fad0465021f9e31a841a18261db/matlab/strred/matlabPyrTools/MEX/pointOp.mexmac -------------------------------------------------------------------------------- /matlab/strred/matlabPyrTools/MEX/pointOp.mexsol: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Netflix/vmaf/b9ac69e6c4231fad0465021f9e31a841a18261db/matlab/strred/matlabPyrTools/MEX/pointOp.mexsol -------------------------------------------------------------------------------- /matlab/strred/matlabPyrTools/MEX/pointOp.o: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Netflix/vmaf/b9ac69e6c4231fad0465021f9e31a841a18261db/matlab/strred/matlabPyrTools/MEX/pointOp.o -------------------------------------------------------------------------------- /matlab/strred/matlabPyrTools/MEX/range2.dll: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Netflix/vmaf/b9ac69e6c4231fad0465021f9e31a841a18261db/matlab/strred/matlabPyrTools/MEX/range2.dll -------------------------------------------------------------------------------- /matlab/strred/matlabPyrTools/MEX/range2.mex: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Netflix/vmaf/b9ac69e6c4231fad0465021f9e31a841a18261db/matlab/strred/matlabPyrTools/MEX/range2.mex -------------------------------------------------------------------------------- /matlab/strred/matlabPyrTools/MEX/range2.mex4: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Netflix/vmaf/b9ac69e6c4231fad0465021f9e31a841a18261db/matlab/strred/matlabPyrTools/MEX/range2.mex4 -------------------------------------------------------------------------------- /matlab/strred/matlabPyrTools/MEX/range2.mexglx: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Netflix/vmaf/b9ac69e6c4231fad0465021f9e31a841a18261db/matlab/strred/matlabPyrTools/MEX/range2.mexglx -------------------------------------------------------------------------------- /matlab/strred/matlabPyrTools/MEX/range2.mexlx: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Netflix/vmaf/b9ac69e6c4231fad0465021f9e31a841a18261db/matlab/strred/matlabPyrTools/MEX/range2.mexlx -------------------------------------------------------------------------------- /matlab/strred/matlabPyrTools/MEX/range2.mexmac: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Netflix/vmaf/b9ac69e6c4231fad0465021f9e31a841a18261db/matlab/strred/matlabPyrTools/MEX/range2.mexmac -------------------------------------------------------------------------------- /matlab/strred/matlabPyrTools/MEX/range2.mexsol: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Netflix/vmaf/b9ac69e6c4231fad0465021f9e31a841a18261db/matlab/strred/matlabPyrTools/MEX/range2.mexsol -------------------------------------------------------------------------------- /matlab/strred/matlabPyrTools/MEX/range2.o: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Netflix/vmaf/b9ac69e6c4231fad0465021f9e31a841a18261db/matlab/strred/matlabPyrTools/MEX/range2.o -------------------------------------------------------------------------------- /matlab/strred/matlabPyrTools/MEX/upConv.dll: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Netflix/vmaf/b9ac69e6c4231fad0465021f9e31a841a18261db/matlab/strred/matlabPyrTools/MEX/upConv.dll -------------------------------------------------------------------------------- /matlab/strred/matlabPyrTools/MEX/upConv.mex: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Netflix/vmaf/b9ac69e6c4231fad0465021f9e31a841a18261db/matlab/strred/matlabPyrTools/MEX/upConv.mex -------------------------------------------------------------------------------- /matlab/strred/matlabPyrTools/MEX/upConv.mex4: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Netflix/vmaf/b9ac69e6c4231fad0465021f9e31a841a18261db/matlab/strred/matlabPyrTools/MEX/upConv.mex4 -------------------------------------------------------------------------------- /matlab/strred/matlabPyrTools/MEX/upConv.mexglx: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Netflix/vmaf/b9ac69e6c4231fad0465021f9e31a841a18261db/matlab/strred/matlabPyrTools/MEX/upConv.mexglx -------------------------------------------------------------------------------- /matlab/strred/matlabPyrTools/MEX/upConv.mexlx: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Netflix/vmaf/b9ac69e6c4231fad0465021f9e31a841a18261db/matlab/strred/matlabPyrTools/MEX/upConv.mexlx -------------------------------------------------------------------------------- /matlab/strred/matlabPyrTools/MEX/upConv.mexmac: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Netflix/vmaf/b9ac69e6c4231fad0465021f9e31a841a18261db/matlab/strred/matlabPyrTools/MEX/upConv.mexmac -------------------------------------------------------------------------------- /matlab/strred/matlabPyrTools/MEX/upConv.mexsol: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Netflix/vmaf/b9ac69e6c4231fad0465021f9e31a841a18261db/matlab/strred/matlabPyrTools/MEX/upConv.mexsol -------------------------------------------------------------------------------- /matlab/strred/matlabPyrTools/MEX/upConv.o: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Netflix/vmaf/b9ac69e6c4231fad0465021f9e31a841a18261db/matlab/strred/matlabPyrTools/MEX/upConv.o -------------------------------------------------------------------------------- /matlab/strred/matlabPyrTools/TUTORIALS/README: -------------------------------------------------------------------------------- 1 | 2 | This directory contains some Matlab script files that serve to give 3 | example usage of this code, and also to explain some of the 4 | representations and algorithms. 5 | 6 | The files are NOT meant to be executed from the MatLab prompt (like many 7 | of the MatLab demos). You should instead read through the comments, 8 | executing the subsequent pieces of code. This gives you a chance to 9 | explore as you go... 10 | 11 | matlabPyrTools.m - Example usage of the code in the distribution. 12 | 13 | pyramids.m - An introduction to multi-scale pyramid representations, 14 | covering Laplacian, QMF/Wavelet, and Steerable pyramids. The 15 | file assumes a knowledge of linear systems, matrix algebra, 16 | and 2D Fourier transforms. 17 | 18 | more to come.... 19 | -------------------------------------------------------------------------------- /matlab/strred/matlabPyrTools/binomialFilter.m: -------------------------------------------------------------------------------- 1 | % KERNEL = binomialFilter(size) 2 | % 3 | % Returns a vector of binomial coefficients of order (size-1) . 4 | 5 | % Eero Simoncelli, 2/97. 6 | 7 | function [kernel] = binomialFilter(sz) 8 | 9 | if (sz < 2) 10 | error('size argument must be larger than 1'); 11 | end 12 | 13 | kernel = [0.5 0.5]'; 14 | 15 | for n=1:sz-2 16 | kernel = conv([0.5 0.5]', kernel); 17 | end 18 | 19 | -------------------------------------------------------------------------------- /matlab/strred/matlabPyrTools/blur.m: -------------------------------------------------------------------------------- 1 | % RES = blur(IM, LEVELS, FILT) 2 | % 3 | % Blur an image, by filtering and downsampling LEVELS times 4 | % (default=1), followed by upsampling and filtering LEVELS times. The 5 | % blurring is done with filter kernel specified by FILT (default = 6 | % 'binom5'), which can be a string (to be passed to namedFilter), a 7 | % vector (applied separably as a 1D convolution kernel in X and Y), or 8 | % a matrix (applied as a 2D convolution kernel). The downsampling is 9 | % always by 2 in each direction. 10 | 11 | % Eero Simoncelli, 3/04. 12 | 13 | function res = blur(im, nlevs, filt) 14 | 15 | %------------------------------------------------------------ 16 | %% OPTIONAL ARGS: 17 | 18 | if (exist('nlevs') ~= 1) 19 | nlevs = 1; 20 | end 21 | 22 | if (exist('filt') ~= 1) 23 | filt = 'binom5'; 24 | end 25 | 26 | %------------------------------------------------------------ 27 | 28 | res = upBlur(blurDn(im,nlevs,filt)); -------------------------------------------------------------------------------- /matlab/strred/matlabPyrTools/buildSpyrLevs.m: -------------------------------------------------------------------------------- 1 | % [PYR, INDICES] = buildSpyrLevs(LOIM, HEIGHT, LOFILT, BFILTS, EDGES) 2 | % 3 | % Recursive function for constructing levels of a steerable pyramid. This 4 | % is called by buildSpyr, and is not usually called directly. 5 | 6 | % Eero Simoncelli, 6/96. 7 | 8 | function [pyr,pind] = buildSpyrLevs(lo0,ht,lofilt,bfilts,edges); 9 | 10 | if (ht <= 0) 11 | 12 | pyr = lo0(:); 13 | pind = size(lo0); 14 | 15 | else 16 | 17 | % Assume square filters: 18 | bfiltsz = round(sqrt(size(bfilts,1))); 19 | 20 | bands = zeros(prod(size(lo0)),size(bfilts,2)); 21 | bind = zeros(size(bfilts,2),2); 22 | 23 | for b = 1:size(bfilts,2) 24 | filt = reshape(bfilts(:,b),bfiltsz,bfiltsz); 25 | band = corrDn(lo0, filt, edges); 26 | bands(:,b) = band(:); 27 | bind(b,:) = size(band); 28 | end 29 | 30 | lo = corrDn(lo0, lofilt, edges, [2 2], [1 1]); 31 | 32 | [npyr,nind] = buildSpyrLevs(lo, ht-1, lofilt, bfilts, edges); 33 | 34 | pyr = [bands(:); npyr]; 35 | pind = [bind; nind]; 36 | 37 | end 38 | -------------------------------------------------------------------------------- /matlab/strred/matlabPyrTools/clip.m: -------------------------------------------------------------------------------- 1 | % [RES] = clip(IM, MINVALorRANGE, MAXVAL) 2 | % 3 | % Clip values of matrix IM to lie between minVal and maxVal: 4 | % RES = max(min(IM,MAXVAL),MINVAL) 5 | % The first argument can also specify both min and max, as a 2-vector. 6 | % If only one argument is passed, the range defaults to [0,1]. 7 | 8 | function res = clip(im, minValOrRange, maxVal) 9 | 10 | if (exist('minValOrRange') ~= 1) 11 | minVal = 0; 12 | maxVal = 1; 13 | elseif (length(minValOrRange) == 2) 14 | minVal = minValOrRange(1); 15 | maxVal = minValOrRange(2); 16 | elseif (length(minValOrRange) == 1) 17 | minVal = minValOrRange; 18 | if (exist('maxVal') ~= 1) 19 | maxVal=minVal+1; 20 | end 21 | else 22 | error('MINVAL must be a scalar or a 2-vector'); 23 | end 24 | 25 | if ( maxVal < minVal ) 26 | error('MAXVAL should be less than MINVAL'); 27 | end 28 | 29 | res = im; 30 | res(find(im < minVal)) = minVal; 31 | res(find(im > maxVal)) = maxVal; 32 | 33 | -------------------------------------------------------------------------------- /matlab/strred/matlabPyrTools/einstein.pgm: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Netflix/vmaf/b9ac69e6c4231fad0465021f9e31a841a18261db/matlab/strred/matlabPyrTools/einstein.pgm -------------------------------------------------------------------------------- /matlab/strred/matlabPyrTools/entropy2.m: -------------------------------------------------------------------------------- 1 | % E = ENTROPY2(MTX,BINSIZE) 2 | % 3 | % Compute the first-order sample entropy of MTX. Samples of VEC are 4 | % first discretized. Optional argument BINSIZE controls the 5 | % discretization, and defaults to 256/(max(VEC)-min(VEC)). 6 | % 7 | % NOTE: This is a heavily biased estimate of entropy when you 8 | % don't have much data. 9 | 10 | % Eero Simoncelli, 6/96. 11 | 12 | function res = entropy2(mtx,binsize) 13 | 14 | %% Ensure it's a vector, not a matrix. 15 | vec = mtx(:); 16 | [mn,mx] = range2(vec); 17 | 18 | if (exist('binsize') == 1) 19 | nbins = max((mx-mn)/binsize, 1); 20 | else 21 | nbins = 256; 22 | end 23 | 24 | [bincount,bins] = histo(vec,nbins); 25 | 26 | %% Collect non-zero bins: 27 | H = bincount(find(bincount)); 28 | H = H/sum(H); 29 | 30 | res = -sum(H .* log2(H)); 31 | 32 | -------------------------------------------------------------------------------- /matlab/strred/matlabPyrTools/factorial.m: -------------------------------------------------------------------------------- 1 | %% RES = factorial(NUM) 2 | % 3 | % Factorial function that works on matrices (matlab's does not). 4 | 5 | % EPS, 11/02 6 | 7 | function res = factorial(num) 8 | 9 | res = ones(size(num)); 10 | 11 | ind = find(num > 0); 12 | if ( ~isempty(ind) ) 13 | subNum = num(ind); 14 | res(ind) = subNum .* factorial(subNum-1); 15 | end 16 | 17 | -------------------------------------------------------------------------------- /matlab/strred/matlabPyrTools/feynman.pgm: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Netflix/vmaf/b9ac69e6c4231fad0465021f9e31a841a18261db/matlab/strred/matlabPyrTools/feynman.pgm -------------------------------------------------------------------------------- /matlab/strred/matlabPyrTools/histoMatch.m: -------------------------------------------------------------------------------- 1 | % RES = histoMatch(MTX, N, X) 2 | % 3 | % Modify elements of MTX so that normalized histogram matches that 4 | % specified by vectors X and N, where N contains the histogram counts 5 | % and X the histogram bin positions (see histo). 6 | 7 | % Eero Simoncelli, 7/96. 8 | 9 | function res = histoMatch(mtx, N, X) 10 | 11 | if ( exist('histo') == 3 ) 12 | [oN, oX] = histo(mtx(:), size(X(:),1)); 13 | else 14 | [oN, oX] = hist(mtx(:), size(X(:),1)); 15 | end 16 | 17 | oStep = oX(2) - oX(1); 18 | oC = [0, cumsum(oN)]/sum(oN); 19 | oX = [oX(1)-oStep/2, oX+oStep/2]; 20 | 21 | N = N(:)'; 22 | X = X(:)'; 23 | N = N + mean(N)/(1e8); %% HACK: no empty bins ensures nC strictly monotonic 24 | 25 | nStep = X(2) - X(1); 26 | nC = [0, cumsum(N)]/sum(N); 27 | nX = [X(1)-nStep/2, X+nStep/2]; 28 | 29 | nnX = interp1(nC, nX, oC, 'linear'); 30 | 31 | if ( exist('pointOp') == 3 ) 32 | res = pointOp(mtx, nnX, oX(1), oStep); 33 | else 34 | res = reshape(interp1(oX, nnX, mtx(:)),size(mtx,1),size(mtx,2)); 35 | end 36 | -------------------------------------------------------------------------------- /matlab/strred/matlabPyrTools/ifftshift.m: -------------------------------------------------------------------------------- 1 | % [RES] = ifftshift (MTX) 2 | % 3 | % Inverse of MatLab's FFTSHIFT. That is, 4 | % ifftshift(fftshift(MTX)) = MTX 5 | % for any size MTX. 6 | 7 | % Eero Simoncelli, 2/97. 8 | 9 | function [res] = ifftshift(mtx) 10 | 11 | sz = size(mtx); 12 | DC = ceil((sz+1)./2); % location of DC term in a matlab fft. 13 | 14 | res = [mtx(DC(1):sz(1), DC(2):sz(2)) , mtx(DC(1):sz(1), 1:DC(2)-1); ... 15 | mtx(1:DC(1)-1, DC(2):sz(2)) , mtx(1:DC(1)-1, 1:DC(2)-1)]; 16 | -------------------------------------------------------------------------------- /matlab/strred/matlabPyrTools/imStats.m: -------------------------------------------------------------------------------- 1 | % imStats(IM1,IM2) 2 | % 3 | % Report image (matrix) statistics. 4 | % When called on a single image IM1, report min, max, mean, stdev, 5 | % and kurtosis. 6 | % When called on two images (IM1 and IM2), report min, max, mean, 7 | % stdev of the difference, and also SNR (relative to IM1). 8 | 9 | % Eero Simoncelli, 6/96. 10 | 11 | function [] = imStats(im1,im2) 12 | 13 | if (~isreal(im1)) 14 | error('Args must be real-valued matrices'); 15 | end 16 | 17 | if (exist('im2') == 1) 18 | difference = im1 - im2; 19 | [mn,mx] = range2(difference); 20 | mean = mean2(difference); 21 | v = var2(difference,mean); 22 | if (v < realmin) 23 | snr = Inf; 24 | else 25 | snr = 10 * log10(var2(im1)/v); 26 | end 27 | fprintf(1, 'Difference statistics:\n'); 28 | fprintf(1, ' Range: [%c, %c]\n',mn,mx); 29 | fprintf(1, ' Mean: %f, Stdev (rmse): %f, SNR (dB): %f\n',... 30 | mean,sqrt(v),snr); 31 | else 32 | [mn,mx] = range2(im1); 33 | mean = mean2(im1); 34 | var = var2(im1); 35 | stdev = sqrt(real(var))+sqrt(imag(var)); 36 | kurt = kurt2(im1, mean, stdev^2); 37 | fprintf(1, 'Image statistics:\n'); 38 | fprintf(1, ' Range: [%f, %f]\n',mn,mx); 39 | fprintf(1, ' Mean: %f, Stdev: %f, Kurtosis: %f\n',mean,stdev,kurt); 40 | end 41 | 42 | -------------------------------------------------------------------------------- /matlab/strred/matlabPyrTools/innerProd.m: -------------------------------------------------------------------------------- 1 | % RES = innerProd(MTX) 2 | % 3 | % Compute (MTX' * MTX) efficiently (i.e., without copying the matrix) 4 | 5 | function res = innerProd(mtx) 6 | 7 | fprintf(1,['WARNING: You should compile the MEX version of' ... 8 | ' "innerProd.c",\n found in the MEX subdirectory' ... 9 | ' of matlabPyrTools, and put it in your matlab path.' ... 10 | ' It is MUCH faster and requires less memory.\n']); 11 | 12 | res = mtx' * mtx; 13 | -------------------------------------------------------------------------------- /matlab/strred/matlabPyrTools/kurt2.m: -------------------------------------------------------------------------------- 1 | % K = KURT2(MTX,MEAN,VAR) 2 | % 3 | % Sample kurtosis (fourth moment divided by squared variance) 4 | % of a matrix. Kurtosis of a Gaussian distribution is 3. 5 | % MEAN (optional) and VAR (optional) make the computation faster. 6 | 7 | % Eero Simoncelli, 6/96. 8 | 9 | function res = kurt2(mtx, mn, v) 10 | 11 | if (exist('mn') ~= 1) 12 | mn = mean(mean(mtx)); 13 | end 14 | 15 | if (exist('v') ~= 1) 16 | v = var2(mtx,mn); 17 | end 18 | 19 | if (isreal(mtx)) 20 | res = mean(mean(abs(mtx-mn).^4)) / (v^2); 21 | else 22 | res = mean(mean(real(mtx-mn).^4)) / (real(v)^2) + ... 23 | i*mean(mean(imag(mtx-mn).^4)) / (imag(v)^2); 24 | end 25 | -------------------------------------------------------------------------------- /matlab/strred/matlabPyrTools/lplot.m: -------------------------------------------------------------------------------- 1 | % lplot(VEC, XRANGE) 2 | % 3 | % Plot VEC, a vector, in "lollipop" format. 4 | % XRANGE (optional, default = [1,length(VEC)]), should be a 2-vector 5 | % specifying the X positions (for labeling purposes) of the first and 6 | % last sample of VEC. 7 | 8 | % Mark Liberman, Linguistics Dept, UPenn, 1994. 9 | 10 | function lplot(x,xrange) 11 | 12 | if (exist('xrange') ~= 1) 13 | xrange = [1,length(x)]; 14 | end 15 | 16 | msize = size(x); 17 | if ( msize(2) == 1) 18 | x = x'; 19 | elseif (msize(1) ~= 1) 20 | error('First arg must be a vector'); 21 | end 22 | 23 | if (~isreal(x)) 24 | fprintf(1,'Warning: Imaginary part of signal ignored\n'); 25 | x = abs(x); 26 | end 27 | 28 | N = length(x); 29 | index = xrange(1) + (xrange(2)-xrange(1))*[0:(N-1)]/(N-1) 30 | xinc = index(2)-index(1); 31 | 32 | xx = [zeros(1,N);x;zeros(1,N)]; 33 | indexis = [index;index;index]; 34 | xdiscrete = [0 xx(:)' 0]; 35 | idiscrete = [index(1)-xinc indexis(:)' index(N)+xinc]; 36 | 37 | [mn,mx] = range2(xdiscrete); 38 | ypad = (mx-mn)/12; % MAGIC NUMBER: graph padding 39 | 40 | plot(idiscrete, xdiscrete, index, x, 'o'); 41 | axis([index(1)-xinc, index(N)+xinc, mn-ypad, mx+ypad]); 42 | 43 | return 44 | -------------------------------------------------------------------------------- /matlab/strred/matlabPyrTools/lpyrHt.m: -------------------------------------------------------------------------------- 1 | % [HEIGHT] = lpyrHt(INDICES) 2 | % 3 | % Compute height of Laplacian pyramid with given its INDICES matrix. 4 | % See buildLpyr.m 5 | 6 | % Eero Simoncelli, 6/96. 7 | 8 | function [ht] = lpyrHt(pind) 9 | 10 | % Don't count lowpass residual band 11 | ht = size(pind,1)-1; 12 | -------------------------------------------------------------------------------- /matlab/strred/matlabPyrTools/maxPyrHt.m: -------------------------------------------------------------------------------- 1 | % HEIGHT = maxPyrHt(IMSIZE, FILTSIZE) 2 | % 3 | % Compute maximum pyramid height for given image and filter sizes. 4 | % Specifically: the number of corrDn operations that can be sequentially 5 | % performed when subsampling by a factor of 2. 6 | 7 | % Eero Simoncelli, 6/96. 8 | 9 | function height = maxPyrHt(imsz, filtsz) 10 | 11 | imsz = imsz(:); 12 | filtsz = filtsz(:); 13 | 14 | if any(imsz == 1) % 1D image 15 | imsz = prod(imsz); 16 | filtsz = prod(filtsz); 17 | elseif any(filtsz == 1) % 2D image, 1D filter 18 | filtsz = [filtsz(1); filtsz(1)]; 19 | end 20 | 21 | if any(imsz < filtsz) 22 | height = 0; 23 | else 24 | height = 1 + maxPyrHt( floor(imsz/2), filtsz ); 25 | end 26 | -------------------------------------------------------------------------------- /matlab/strred/matlabPyrTools/mean2.m: -------------------------------------------------------------------------------- 1 | % M = MEAN2(MTX) 2 | % 3 | % Sample mean of a matrix. 4 | 5 | function res = mean2(mtx) 6 | 7 | res = mean(mean(mtx)); 8 | -------------------------------------------------------------------------------- /matlab/strred/matlabPyrTools/mkAngle.m: -------------------------------------------------------------------------------- 1 | % IM = mkAngle(SIZE, PHASE, ORIGIN) 2 | % 3 | % Compute a matrix of dimension SIZE (a [Y X] 2-vector, or a scalar) 4 | % containing samples of the polar angle (in radians, CW from the 5 | % X-axis, ranging from -pi to pi), relative to angle PHASE (default = 6 | % 0), about ORIGIN pixel (default = (size+1)/2). 7 | 8 | % Eero Simoncelli, 6/96. 9 | 10 | function [res] = mkAngle(sz, phase, origin) 11 | 12 | sz = sz(:); 13 | if (size(sz,1) == 1) 14 | sz = [sz,sz]; 15 | end 16 | 17 | % ----------------------------------------------------------------- 18 | % OPTIONAL args: 19 | 20 | if (exist('origin') ~= 1) 21 | origin = (sz+1)/2; 22 | end 23 | 24 | % ----------------------------------------------------------------- 25 | 26 | [xramp,yramp] = meshgrid( [1:sz(2)]-origin(2), [1:sz(1)]-origin(1) ); 27 | 28 | res = atan2(yramp,xramp); 29 | 30 | if (exist('phase') == 1) 31 | res = mod(res+(pi-phase),2*pi)-pi; 32 | end 33 | -------------------------------------------------------------------------------- /matlab/strred/matlabPyrTools/mkAngularSine.m: -------------------------------------------------------------------------------- 1 | % IM = mkAngularSine(SIZE, HARMONIC, AMPL, PHASE, ORIGIN) 2 | % 3 | % Make an angular sinusoidal image: 4 | % AMPL * sin( HARMONIC*theta + PHASE), 5 | % where theta is the angle about the origin. 6 | % SIZE specifies the matrix size, as for zeros(). 7 | % AMPL (default = 1) and PHASE (default = 0) are optional. 8 | 9 | % Eero Simoncelli, 2/97. 10 | 11 | function [res] = mkAngularSine(sz, harmonic, ampl, ph, origin) 12 | 13 | sz = sz(:); 14 | if (size(sz,1) == 1) 15 | sz = [sz,sz]; 16 | end 17 | 18 | mxsz = max(sz(1),sz(2)); 19 | 20 | %------------------------------------------------------------ 21 | %% OPTIONAL ARGS: 22 | 23 | if (exist('harmonic') ~= 1) 24 | harmonic = 1; 25 | end 26 | 27 | if (exist('ampl') ~= 1) 28 | ampl = 1; 29 | end 30 | 31 | if (exist('ph') ~= 1) 32 | ph = 0; 33 | end 34 | 35 | if (exist('origin') ~= 1) 36 | origin = (sz+1)/2; 37 | end 38 | 39 | %------------------------------------------------------------ 40 | 41 | res = ampl * sin(harmonic*mkAngle(sz,ph,origin) + ph); 42 | 43 | -------------------------------------------------------------------------------- /matlab/strred/matlabPyrTools/mkFract.m: -------------------------------------------------------------------------------- 1 | % IM = mkFract(SIZE, FRACT_DIM) 2 | % 3 | % Make a matrix of dimensions SIZE (a [Y X] 2-vector, or a scalar) 4 | % containing fractal (pink) noise with power spectral density of the 5 | % form: 1/f^(5-2*FRACT_DIM). Image variance is normalized to 1.0. 6 | % FRACT_DIM defaults to 1.0 7 | 8 | % Eero Simoncelli, 6/96. 9 | 10 | %% TODO: Verify that this matches Mandelbrot defn of fractal dimension. 11 | %% Make this more efficient! 12 | 13 | function res = mkFract(dims, fract_dim) 14 | 15 | if (exist('fract_dim') ~= 1) 16 | fract_dim = 1.0; 17 | end 18 | 19 | res = randn(dims); 20 | fres = fft2(res); 21 | 22 | sz = size(res); 23 | ctr = ceil((sz+1)./2); 24 | 25 | shape = ifftshift(mkR(sz, -(2.5-fract_dim), ctr)); 26 | shape(1,1) = 1; %%DC term 27 | 28 | fres = shape .* fres; 29 | fres = ifft2(fres); 30 | 31 | if (max(max(abs(imag(fres)))) > 1e-10) 32 | error('Symmetry error in creating fractal'); 33 | else 34 | res = real(fres); 35 | res = res / sqrt(var2(res)); 36 | end 37 | -------------------------------------------------------------------------------- /matlab/strred/matlabPyrTools/mkImpulse.m: -------------------------------------------------------------------------------- 1 | % IM = mkImpulse(SIZE, ORIGIN, AMPLITUDE) 2 | % 3 | % Compute a matrix of dimension SIZE (a [Y X] 2-vector, or a scalar) 4 | % containing a single non-zero entry, at position ORIGIN (defaults to 5 | % ceil(size/2)), of value AMPLITUDE (defaults to 1). 6 | 7 | % Eero Simoncelli, 6/96. 8 | 9 | function [res] = mkImpulse(sz, origin, amplitude) 10 | 11 | sz = sz(:)'; 12 | if (size(sz,2) == 1) 13 | sz = [sz sz]; 14 | end 15 | 16 | if (exist('origin') ~= 1) 17 | origin = ceil(sz/2); 18 | end 19 | 20 | if (exist('amplitude') ~= 1) 21 | amplitude = 1; 22 | end 23 | 24 | res = zeros(sz); 25 | res(origin(1),origin(2)) = amplitude; 26 | -------------------------------------------------------------------------------- /matlab/strred/matlabPyrTools/mkR.m: -------------------------------------------------------------------------------- 1 | % IM = mkR(SIZE, EXPT, ORIGIN) 2 | % 3 | % Compute a matrix of dimension SIZE (a [Y X] 2-vector, or a scalar) 4 | % containing samples of a radial ramp function, raised to power EXPT 5 | % (default = 1), with given ORIGIN (default = (size+1)/2, [1 1] = 6 | % upper left). All but the first argument are optional. 7 | 8 | % Eero Simoncelli, 6/96. 9 | 10 | function [res] = mkR(sz, expt, origin) 11 | 12 | sz = sz(:); 13 | if (size(sz,1) == 1) 14 | sz = [sz,sz]; 15 | end 16 | 17 | % ----------------------------------------------------------------- 18 | % OPTIONAL args: 19 | 20 | if (exist('expt') ~= 1) 21 | expt = 1; 22 | end 23 | 24 | if (exist('origin') ~= 1) 25 | origin = (sz+1)/2; 26 | end 27 | 28 | % ----------------------------------------------------------------- 29 | 30 | [xramp,yramp] = meshgrid( [1:sz(2)]-origin(2), [1:sz(1)]-origin(1) ); 31 | 32 | res = (xramp.^2 + yramp.^2).^(expt/2); 33 | -------------------------------------------------------------------------------- /matlab/strred/matlabPyrTools/mkRamp.m: -------------------------------------------------------------------------------- 1 | % IM = mkRamp(SIZE, DIRECTION, SLOPE, INTERCEPT, ORIGIN) 2 | % 3 | % Compute a matrix of dimension SIZE (a [Y X] 2-vector, or a scalar) 4 | % containing samples of a ramp function, with given gradient DIRECTION 5 | % (radians, CW from X-axis, default = 0), SLOPE (per pixel, default = 6 | % 1), and a value of INTERCEPT (default = 0) at the ORIGIN (default = 7 | % (size+1)/2, [1 1] = upper left). All but the first argument are 8 | % optional. 9 | 10 | % Eero Simoncelli, 6/96. 2/97: adjusted coordinate system. 11 | 12 | function [res] = mkRamp(sz, dir, slope, intercept, origin) 13 | 14 | sz = sz(:); 15 | if (size(sz,1) == 1) 16 | sz = [sz,sz]; 17 | end 18 | 19 | % ----------------------------------------------------------------- 20 | % OPTIONAL args: 21 | 22 | if (exist('dir') ~= 1) 23 | dir = 0; 24 | end 25 | 26 | if (exist('slope') ~= 1) 27 | slope = 1; 28 | end 29 | 30 | if (exist('intercept') ~= 1) 31 | intercept = 0; 32 | end 33 | 34 | if (exist('origin') ~= 1) 35 | origin = (sz+1)/2; 36 | end 37 | 38 | % ----------------------------------------------------------------- 39 | 40 | xinc = slope*cos(dir); 41 | yinc = slope*sin(dir); 42 | 43 | [xramp,yramp] = meshgrid( xinc*([1:sz(2)]-origin(2)), ... 44 | yinc*([1:sz(1)]-origin(1)) ); 45 | 46 | res = intercept + xramp + yramp; 47 | 48 | -------------------------------------------------------------------------------- /matlab/strred/matlabPyrTools/mkZonePlate.m: -------------------------------------------------------------------------------- 1 | % IM = mkZonePlate(SIZE, AMPL, PHASE) 2 | % 3 | % Make a "zone plate" image: 4 | % AMPL * cos( r^2 + PHASE) 5 | % SIZE specifies the matrix size, as for zeros(). 6 | % AMPL (default = 1) and PHASE (default = 0) are optional. 7 | 8 | % Eero Simoncelli, 6/96. 9 | 10 | function [res] = mkZonePlate(sz, ampl, ph) 11 | 12 | sz = sz(:); 13 | if (size(sz,1) == 1) 14 | sz = [sz,sz]; 15 | end 16 | 17 | mxsz = max(sz(1),sz(2)); 18 | 19 | %------------------------------------------------------------ 20 | %% OPTIONAL ARGS: 21 | 22 | if (exist('ampl') ~= 1) 23 | ampl = 1; 24 | end 25 | 26 | if (exist('ph') ~= 1) 27 | ph = 0; 28 | end 29 | 30 | %------------------------------------------------------------ 31 | 32 | res = ampl * cos( (pi/mxsz) * mkR(sz,2) + ph ); 33 | 34 | -------------------------------------------------------------------------------- /matlab/strred/matlabPyrTools/mod1.m: -------------------------------------------------------------------------------- 1 | % M = mod(A,B) 2 | % 3 | % Modulus operator: returns A mod B. 4 | % Works on matrics, vectors or scalars. 5 | % 6 | % NOTE: This function is a Matlab-5 builtin, but was missing from Matlab-4. 7 | 8 | % Eero Simoncelli, 7/96. 9 | 10 | function m = mod(a,n) 11 | 12 | m = a - n .* floor(a./n); 13 | return; 14 | 15 | -------------------------------------------------------------------------------- /matlab/strred/matlabPyrTools/modulateFlip.m: -------------------------------------------------------------------------------- 1 | % [HFILT] = modulateFlipShift(LFILT) 2 | % 3 | % QMF/Wavelet highpass filter construction: modulate by (-1)^n, 4 | % reverse order (and shift by one, which is handled by the convolution 5 | % routines). This is an extension of the original definition of QMF's 6 | % (e.g., see Simoncelli90). 7 | 8 | % Eero Simoncelli, 7/96. 9 | 10 | function [hfilt] = modulateFlipShift(lfilt) 11 | 12 | lfilt = lfilt(:); 13 | 14 | sz = size(lfilt,1); 15 | sz2 = ceil(sz/2); 16 | 17 | ind = [sz:-1:1]'; 18 | 19 | hfilt = lfilt(ind) .* (-1).^(ind-sz2); 20 | -------------------------------------------------------------------------------- /matlab/strred/matlabPyrTools/nextFig.m: -------------------------------------------------------------------------------- 1 | % nextFig (MAXFIGS, SKIP) 2 | % 3 | % Make figure number mod((GCF+SKIP), MAXFIGS) the current figure. 4 | % MAXFIGS is optional, and defaults to 2. 5 | % SKIP is optional, and defaults to 1. 6 | 7 | % Eero Simoncelli, 2/97. 8 | 9 | function nextFig(maxfigs, skip) 10 | 11 | if (exist('maxfigs') ~= 1) 12 | maxfigs = 2; 13 | end 14 | 15 | if (exist('skip') ~= 1) 16 | skip = 1; 17 | end 18 | 19 | figure(1+mod(gcf-1+skip,maxfigs)); 20 | -------------------------------------------------------------------------------- /matlab/strred/matlabPyrTools/pointOp.m: -------------------------------------------------------------------------------- 1 | % RES = pointOp(IM, LUT, ORIGIN, INCREMENT, WARNINGS) 2 | % 3 | % Apply a point operation, specified by lookup table LUT, to image IM. 4 | % LUT must be a row or column vector, and is assumed to contain 5 | % (equi-spaced) samples of the function. ORIGIN specifies the 6 | % abscissa associated with the first sample, and INCREMENT specifies the 7 | % spacing between samples. Between-sample values are estimated via 8 | % linear interpolation. If WARNINGS is non-zero, the function prints 9 | % a warning whenever the lookup table is extrapolated. 10 | % 11 | % This function is much faster than MatLab's interp1, and allows 12 | % extrapolation beyond the lookup table domain. The drawbacks are 13 | % that the lookup table must be equi-spaced, and the interpolation is 14 | % linear. 15 | 16 | % Eero Simoncelli, 8/96. 17 | 18 | function res = pointOp(im, lut, origin, increment, warnings) 19 | 20 | %% NOTE: THIS CODE IS NOT ACTUALLY USED! (MEX FILE IS CALLED INSTEAD) 21 | 22 | fprintf(1,'WARNING: You should compile the MEX version of "pointOp.c",\n found in the MEX subdirectory of matlabPyrTools, and put it in your matlab path. It is MUCH faster.\n'); 23 | 24 | X = origin + increment*[0:size(lut(:),1)-1]; 25 | Y = lut(:); 26 | 27 | res = reshape(interp1(X, Y, im(:), 'linear', 'extrap'),size(im)); 28 | 29 | -------------------------------------------------------------------------------- /matlab/strred/matlabPyrTools/pwd2path.m: -------------------------------------------------------------------------------- 1 | % PWD2PATH() 2 | % 3 | % add current working directory (pwd) to path. 4 | 5 | P = path; 6 | path(pwd,P); 7 | -------------------------------------------------------------------------------- /matlab/strred/matlabPyrTools/pyrBand.m: -------------------------------------------------------------------------------- 1 | % RES = pyrBand(PYR, INDICES, BAND_NUM) 2 | % 3 | % Access a subband from a pyramid (gaussian, laplacian, QMF/wavelet, 4 | % or steerable). Subbands are numbered consecutively, from finest 5 | % (highest spatial frequency) to coarsest (lowest spatial frequency). 6 | 7 | % Eero Simoncelli, 6/96. 8 | 9 | function res = pyrBand(pyr, pind, band) 10 | 11 | res = reshape( pyr(pyrBandIndices(pind,band)), pind(band,1), pind(band,2) ); 12 | -------------------------------------------------------------------------------- /matlab/strred/matlabPyrTools/pyrBandIndices.m: -------------------------------------------------------------------------------- 1 | % RES = pyrBandIndices(INDICES, BAND_NUM) 2 | % 3 | % Return indices for accessing a subband from a pyramid 4 | % (gaussian, laplacian, QMF/wavelet, steerable). 5 | 6 | % Eero Simoncelli, 6/96. 7 | 8 | function indices = pyrBandIndices(pind,band) 9 | 10 | if ((band > size(pind,1)) | (band < 1)) 11 | error(sprintf('BAND_NUM must be between 1 and number of pyramid bands (%d).', ... 12 | size(pind,1))); 13 | end 14 | 15 | if (size(pind,2) ~= 2) 16 | error('INDICES must be an Nx2 matrix indicating the size of the pyramid subbands'); 17 | end 18 | 19 | ind = 1; 20 | for l=1:band-1 21 | ind = ind + prod(pind(l,:)); 22 | end 23 | 24 | indices = ind:ind+prod(pind(band,:))-1; 25 | -------------------------------------------------------------------------------- /matlab/strred/matlabPyrTools/pyrLow.m: -------------------------------------------------------------------------------- 1 | % RES = pyrLow(PYR, INDICES) 2 | % 3 | % Access the lowpass subband from a pyramid 4 | % (gaussian, laplacian, QMF/wavelet, steerable). 5 | 6 | % Eero Simoncelli, 6/96. 7 | 8 | function res = pyrLow(pyr,pind) 9 | 10 | band = size(pind,1); 11 | 12 | res = reshape( pyr(pyrBandIndices(pind,band)), pind(band,1), pind(band,2) ); 13 | -------------------------------------------------------------------------------- /matlab/strred/matlabPyrTools/range2.m: -------------------------------------------------------------------------------- 1 | % [MIN, MAX] = range2(MTX) 2 | % 3 | % Compute minimum and maximum values of MTX, returning them as a 2-vector. 4 | 5 | % Eero Simoncelli, 3/97. 6 | 7 | function [mn, mx] = range2(mtx) 8 | 9 | %% NOTE: THIS CODE IS NOT ACTUALLY USED! (MEX FILE IS CALLED INSTEAD) 10 | 11 | fprintf(1,'WARNING: You should compile the MEX version of "range2.c",\n found in the MEX subdirectory of matlabPyrTools, and put it in your matlab path. It is MUCH faster.\n'); 12 | 13 | if (~isreal(mtx)) 14 | error('MTX must be real-valued'); 15 | end 16 | 17 | mn = min(min(mtx)); 18 | mx = max(max(mtx)); 19 | -------------------------------------------------------------------------------- /matlab/strred/matlabPyrTools/rcosFn.m: -------------------------------------------------------------------------------- 1 | % [X, Y] = rcosFn(WIDTH, POSITION, VALUES) 2 | % 3 | % Return a lookup table (suitable for use by INTERP1) 4 | % containing a "raised cosine" soft threshold function: 5 | % 6 | % Y = VALUES(1) + (VALUES(2)-VALUES(1)) * 7 | % cos^2( PI/2 * (X - POSITION + WIDTH)/WIDTH ) 8 | % 9 | % WIDTH is the width of the region over which the transition occurs 10 | % (default = 1). POSITION is the location of the center of the 11 | % threshold (default = 0). VALUES (default = [0,1]) specifies the 12 | % values to the left and right of the transition. 13 | 14 | % Eero Simoncelli, 7/96. 15 | 16 | function [X, Y] = rcosFn(width,position,values) 17 | 18 | %------------------------------------------------------------ 19 | % OPTIONAL ARGS: 20 | 21 | if (exist('width') ~= 1) 22 | width = 1; 23 | end 24 | 25 | if (exist('position') ~= 1) 26 | position = 0; 27 | end 28 | 29 | if (exist('values') ~= 1) 30 | values = [0,1]; 31 | end 32 | 33 | %------------------------------------------------------------ 34 | 35 | sz = 256; %% arbitrary! 36 | 37 | X = pi * [-sz-1:1] / (2*sz); 38 | 39 | Y = values(1) + (values(2)-values(1)) * cos(X).^2; 40 | 41 | % Make sure end values are repeated, for extrapolation... 42 | Y(1) = Y(2); 43 | Y(sz+3) = Y(sz+2); 44 | 45 | X = position + (2*width/pi) * (X + pi/4); 46 | -------------------------------------------------------------------------------- /matlab/strred/matlabPyrTools/reconSpyrLevs.m: -------------------------------------------------------------------------------- 1 | % RES = reconSpyrLevs(PYR,INDICES,LOFILT,BFILTS,EDGES,LEVS,BANDS) 2 | % 3 | % Recursive function for reconstructing levels of a steerable pyramid 4 | % representation. This is called by reconSpyr, and is not usually 5 | % called directly. 6 | 7 | % Eero Simoncelli, 6/96. 8 | 9 | function res = reconSpyrLevs(pyr,pind,lofilt,bfilts,edges,levs,bands); 10 | 11 | nbands = size(bfilts,2); 12 | lo_ind = nbands+1; 13 | res_sz = pind(1,:); 14 | 15 | % Assume square filters: 16 | bfiltsz = round(sqrt(size(bfilts,1))); 17 | 18 | if any(levs > 1) 19 | 20 | if (size(pind,1) > lo_ind) 21 | nres = reconSpyrLevs( pyr(1+sum(prod(pind(1:lo_ind-1,:)')):size(pyr,1)), ... 22 | pind(lo_ind:size(pind,1),:), ... 23 | lofilt, bfilts, edges, levs-1, bands); 24 | else 25 | nres = pyrBand(pyr,pind,lo_ind); % lowpass subband 26 | end 27 | 28 | res = upConv(nres, lofilt, edges, [2 2], [1 1], res_sz); 29 | 30 | else 31 | 32 | res = zeros(res_sz); 33 | 34 | end 35 | 36 | if any(levs == 1) 37 | ind = 1; 38 | for b = 1:nbands 39 | if any(bands == b) 40 | bfilt = reshape(bfilts(:,b), bfiltsz, bfiltsz); 41 | upConv(reshape(pyr(ind:ind+prod(res_sz)-1), res_sz(1), res_sz(2)), ... 42 | bfilt, edges, [1 1], [1 1], res_sz, res); 43 | end 44 | ind = ind + prod(res_sz); 45 | end 46 | end 47 | -------------------------------------------------------------------------------- /matlab/strred/matlabPyrTools/setPyrBand.m: -------------------------------------------------------------------------------- 1 | % NEWPYR = setPyrBand(PYR, INDICES, BAND, BAND_NUM) 2 | % 3 | % Insert an image (BAND) into a pyramid (gaussian, laplacian, QMF/wavelet, 4 | % or steerable). Subbands are numbered consecutively, from finest 5 | % (highest spatial frequency) to coarsest (lowest spatial frequency). 6 | 7 | % Eero Simoncelli, 1/03. 8 | 9 | function pyr = pyrBand(pyr, pind, band, bandNum) 10 | 11 | %% Check: PIND a valid index matrix? 12 | if ( ~(ndims(pind) == 2) | ~(size(pind,2) == 2) | ~all(pind==round(pind)) ) 13 | pind 14 | error('pyrTools:badArg',... 15 | 'PIND argument is not an Nbands X 2 matrix of integers'); 16 | end 17 | 18 | %% Check: PIND consistent with size of PYR? 19 | if ( length(pyr) ~= sum(prod(pind,2)) ) 20 | error('pyrTools:badPyr',... 21 | 'Pyramid data vector length is inconsistent with index matrix PIND'); 22 | end 23 | 24 | %% Check: size of BAND consistent with desired BANDNUM? 25 | if (~all(size(band) == pind(bandNum,:))) 26 | size(band) 27 | pind(bandNum,:) 28 | error('pyrTools:badArg',... 29 | 'size of BAND to be inserted is inconsistent with BAND_NUM'); 30 | end 31 | 32 | pyr(pyrBandIndices(pind,bandNum)) = vectify(band); 33 | -------------------------------------------------------------------------------- /matlab/strred/matlabPyrTools/shift.m: -------------------------------------------------------------------------------- 1 | % [RES] = shift(MTX, OFFSET) 2 | % 3 | % Circular shift 2D matrix samples by OFFSET (a [Y,X] 2-vector), 4 | % such that RES(POS) = MTX(POS-OFFSET). 5 | 6 | function res = shift(mtx, offset) 7 | 8 | dims = size(mtx); 9 | 10 | offset = mod(-offset,dims); 11 | 12 | res = [ mtx(offset(1)+1:dims(1), offset(2)+1:dims(2)), ... 13 | mtx(offset(1)+1:dims(1), 1:offset(2)); ... 14 | mtx(1:offset(1), offset(2)+1:dims(2)), ... 15 | mtx(1:offset(1), 1:offset(2)) ]; 16 | -------------------------------------------------------------------------------- /matlab/strred/matlabPyrTools/simulate.m: -------------------------------------------------------------------------------- 1 | clear all; close all; clc 2 | path('D:\GSM\matlabPyrTools\',path); 3 | im = pgmRead('einstein.pgm'); 4 | Nsc = 4; Nor = 3; 5 | [pyr,pind] = buildSFpyr(im,Nsc,Nor); 6 | nband = 2; 7 | aux = pyrBand(pyr, pind, nband); -------------------------------------------------------------------------------- /matlab/strred/matlabPyrTools/skew2.m: -------------------------------------------------------------------------------- 1 | % S = SKEW2(MTX,MEAN,VAR) 2 | % 3 | % Sample skew (third moment divided by variance^3/2) of a matrix. 4 | % MEAN (optional) and VAR (optional) make the computation faster. 5 | 6 | function res = skew2(mtx, mn, v) 7 | 8 | if (exist('mn') ~= 1) 9 | mn = mean2(mtx); 10 | end 11 | 12 | if (exist('v') ~= 1) 13 | v = var2(mtx,mn); 14 | end 15 | 16 | if (isreal(mtx)) 17 | res = mean(mean((mtx-mn).^3)) / (v^(3/2)); 18 | else 19 | res = mean(mean(real(mtx-mn).^3)) / (real(v)^(3/2)) + ... 20 | i * mean(mean(imag(mtx-mn).^3)) / (imag(v)^(3/2)); 21 | end 22 | -------------------------------------------------------------------------------- /matlab/strred/matlabPyrTools/spyrBand.m: -------------------------------------------------------------------------------- 1 | % [LEV,IND] = spyrBand(PYR,INDICES,LEVEL,BAND) 2 | % 3 | % Access a band from a steerable pyramid. 4 | % 5 | % LEVEL indicates the scale (finest = 1, coarsest = spyrHt(INDICES)). 6 | % 7 | % BAND (optional, default=1) indicates which subband 8 | % (1 = vertical, rest proceeding anti-clockwise). 9 | 10 | % Eero Simoncelli, 6/96. 11 | 12 | function res = spyrBand(pyr,pind,level,band) 13 | 14 | if (exist('level') ~= 1) 15 | level = 1; 16 | end 17 | 18 | if (exist('band') ~= 1) 19 | band = 1; 20 | end 21 | 22 | nbands = spyrNumBands(pind); 23 | if ((band > nbands) | (band < 1)) 24 | error(sprintf('Bad band number (%d) should be in range [1,%d].', band, nbands)); 25 | end 26 | 27 | maxLev = spyrHt(pind); 28 | if ((level > maxLev) | (level < 1)) 29 | error(sprintf('Bad level number (%d), should be in range [1,%d].', level, maxLev)); 30 | end 31 | 32 | firstband = 1 + band + nbands*(level-1); 33 | res = pyrBand(pyr, pind, firstband); 34 | 35 | -------------------------------------------------------------------------------- /matlab/strred/matlabPyrTools/spyrHigh.m: -------------------------------------------------------------------------------- 1 | % RES = spyrHigh(PYR, INDICES) 2 | % 3 | % Access the highpass residual band from a steerable pyramid. 4 | 5 | % Eero Simoncelli, 6/96. 6 | 7 | function res = spyrHigh(pyr,pind) 8 | 9 | res = pyrBand(pyr, pind, 1); 10 | 11 | -------------------------------------------------------------------------------- /matlab/strred/matlabPyrTools/spyrHt.m: -------------------------------------------------------------------------------- 1 | % [HEIGHT] = spyrHt(INDICES) 2 | % 3 | % Compute height of steerable pyramid with given index matrix. 4 | 5 | % Eero Simoncelli, 6/96. 6 | 7 | function [ht] = spyrHt(pind) 8 | 9 | nbands = spyrNumBands(pind); 10 | 11 | % Don't count lowpass, or highpass residual bands 12 | if (size(pind,1) > 2) 13 | ht = (size(pind,1)-2)/nbands; 14 | else 15 | ht = 0; 16 | end 17 | -------------------------------------------------------------------------------- /matlab/strred/matlabPyrTools/spyrLev.m: -------------------------------------------------------------------------------- 1 | % [LEV,IND] = spyrLev(PYR,INDICES,LEVEL) 2 | % 3 | % Access a level from a steerable pyramid. 4 | % Return as an SxB matrix, B = number of bands, S = total size of a band. 5 | % Also returns an Bx2 matrix containing dimensions of the subbands. 6 | 7 | % Eero Simoncelli, 6/96. 8 | 9 | function [lev,ind] = spyrLev(pyr,pind,level) 10 | 11 | nbands = spyrNumBands(pind); 12 | 13 | if ((level > spyrHt(pind)) | (level < 1)) 14 | error(sprintf('Level number must be in the range [1, %d].', spyrHt(pind))); 15 | end 16 | 17 | firstband = 2 + nbands*(level-1); 18 | firstind = 1; 19 | for l=1:firstband-1 20 | firstind = firstind + prod(pind(l,:)); 21 | end 22 | 23 | ind = pind(firstband:firstband+nbands-1,:); 24 | lev = pyr(firstind:firstind+sum(prod(ind'))-1); 25 | -------------------------------------------------------------------------------- /matlab/strred/matlabPyrTools/spyrNumBands.m: -------------------------------------------------------------------------------- 1 | % [NBANDS] = spyrNumBands(INDICES) 2 | % 3 | % Compute number of orientation bands in a steerable pyramid with 4 | % given index matrix. If the pyramid contains only the highpass and 5 | % lowpass bands (i.e., zero levels), returns 0. 6 | 7 | % Eero Simoncelli, 2/97. 8 | 9 | function [nbands] = spyrNumBands(pind) 10 | 11 | if (size(pind,1) == 2) 12 | nbands = 0; 13 | else 14 | % Count number of orientation bands: 15 | b = 3; 16 | while ((b <= size(pind,1)) & all( pind(b,:) == pind(2,:)) ) 17 | b = b+1; 18 | end 19 | nbands = b-2; 20 | end 21 | -------------------------------------------------------------------------------- /matlab/strred/matlabPyrTools/subMtx.m: -------------------------------------------------------------------------------- 1 | % MTX = subMtx(VEC, DIMENSIONS, START_INDEX) 2 | % 3 | % Reshape a portion of VEC starting from START_INDEX (optional, 4 | % default=1) to the given dimensions. 5 | 6 | % Eero Simoncelli, 6/96. 7 | 8 | function mtx = subMtx(vec, sz, offset) 9 | 10 | if (exist('offset') ~= 1) 11 | offset = 1; 12 | end 13 | 14 | vec = vec(:); 15 | sz = sz(:); 16 | 17 | if (size(sz,1) ~= 2) 18 | error('DIMENSIONS must be a 2-vector.'); 19 | end 20 | 21 | mtx = reshape( vec(offset:offset+prod(sz)-1), sz(1), sz(2) ); 22 | -------------------------------------------------------------------------------- /matlab/strred/matlabPyrTools/var2.m: -------------------------------------------------------------------------------- 1 | % V = VAR2(MTX,MEAN) 2 | % 3 | % Sample variance of a matrix. 4 | % Passing MEAN (optional) makes the calculation faster. 5 | 6 | function res = var2(mtx, mn) 7 | 8 | if (exist('mn') ~= 1) 9 | mn = mean2(mtx); 10 | end 11 | 12 | if (isreal(mtx)) 13 | res = sum(sum(abs(mtx-mn).^2)) / max((prod(size(mtx)) - 1),1); 14 | else 15 | res = sum(sum(real(mtx-mn).^2)) + i*sum(sum(imag(mtx-mn).^2)); 16 | res = res / max((prod(size(mtx)) - 1),1); 17 | end 18 | -------------------------------------------------------------------------------- /matlab/strred/matlabPyrTools/vectify.m: -------------------------------------------------------------------------------- 1 | % [VEC] = columnize(MTX) 2 | % 3 | % Pack elements of MTX into a column vector. Just provides a 4 | % function-call notatoin for the operation MTX(:) 5 | 6 | function vec = columnize(mtx) 7 | 8 | vec = mtx(:); 9 | -------------------------------------------------------------------------------- /matlab/strred/matlabPyrTools/wpyrBand.m: -------------------------------------------------------------------------------- 1 | % RES = wpyrBand(PYR, INDICES, LEVEL, BAND) 2 | % 3 | % Access a subband from a separable QMF/wavelet pyramid. 4 | % 5 | % LEVEL (optional, default=1) indicates the scale (finest = 1, 6 | % coarsest = wpyrHt(INDICES)). 7 | % 8 | % BAND (optional, default=1) indicates which subband (1=horizontal, 9 | % 2=vertical, 3=diagonal). 10 | 11 | % Eero Simoncelli, 6/96. 12 | 13 | function im = wpyrBand(pyr,pind,level,band) 14 | 15 | if (exist('level') ~= 1) 16 | level = 1; 17 | end 18 | 19 | if (exist('band') ~= 1) 20 | band = 1; 21 | end 22 | 23 | if ((pind(1,1) == 1) | (pind(1,2) ==1)) 24 | nbands = 1; 25 | else 26 | nbands = 3; 27 | end 28 | 29 | if ((band > nbands) | (band < 1)) 30 | error(sprintf('Bad band number (%d) should be in range [1,%d].', band, nbands)); 31 | end 32 | 33 | maxLev = wpyrHt(pind); 34 | if ((level > maxLev) | (level < 1)) 35 | error(sprintf('Bad level number (%d), should be in range [1,%d].', level, maxLev)); 36 | end 37 | 38 | band = band + nbands*(level-1); 39 | im = pyrBand(pyr,pind,band); 40 | -------------------------------------------------------------------------------- /matlab/strred/matlabPyrTools/wpyrHt.m: -------------------------------------------------------------------------------- 1 | % [HEIGHT] = wpyrHt(INDICES) 2 | % 3 | % Compute height of separable QMF/wavelet pyramid with given index matrix. 4 | 5 | % Eero Simoncelli, 6/96. 6 | 7 | function [ht] = wpyrHt(pind) 8 | 9 | if ((pind(1,1) == 1) | (pind(1,2) ==1)) 10 | nbands = 1; 11 | else 12 | nbands = 3; 13 | end 14 | 15 | ht = (size(pind,1)-1)/nbands; 16 | -------------------------------------------------------------------------------- /matlab/strred/matlabPyrTools/wpyrLev.m: -------------------------------------------------------------------------------- 1 | % [LEV,IND] = wpyrLev(PYR,INDICES,LEVEL) 2 | % 3 | % Access a level from a separable QMF/wavelet pyramid. 4 | % Return as an SxB matrix, B = number of bands, S = total size of a band. 5 | % Also returns an Bx2 matrix containing dimensions of the subbands. 6 | 7 | % Eero Simoncelli, 6/96. 8 | 9 | function [lev,ind] = wpyrLev(pyr,pind,level) 10 | 11 | if ((pind(1,1) == 1) | (pind(1,2) ==1)) 12 | nbands = 1; 13 | else 14 | nbands = 3; 15 | end 16 | 17 | if ((level > wpyrHt(pind)) | (level < 1)) 18 | error(sprintf('Level number must be in the range [1, %d].', wpyrHt(pind))); 19 | end 20 | 21 | firstband = 1 + nbands*(level-1) 22 | firstind = 1; 23 | for l=1:firstband-1 24 | firstind = firstind + prod(pind(l,:)); 25 | end 26 | 27 | 28 | ind = pind(firstband:firstband+nbands-1,:); 29 | lev = pyr(firstind:firstind+sum(prod(ind'))-1); 30 | 31 | -------------------------------------------------------------------------------- /matlab/strred/matlabPyrTools/zconv2.m: -------------------------------------------------------------------------------- 1 | % RES = ZCONV2(MTX1, MTX2, CTR) 2 | % 3 | % Convolution of two matrices, with boundaries handled as if the larger mtx 4 | % lies in a sea of zeros. Result will be of size of LARGER vector. 5 | % 6 | % The origin of the smaller matrix is assumed to be its center. 7 | % For even dimensions, the origin is determined by the CTR (optional) 8 | % argument: 9 | % CTR origin 10 | % 0 DIM/2 (default) 11 | % 1 (DIM/2)+1 (behaves like conv2(mtx1,mtx2,'same')) 12 | 13 | % Eero Simoncelli, 2/97. 14 | 15 | function c = zconv2(a,b,ctr) 16 | 17 | if (exist('ctr') ~= 1) 18 | ctr = 0; 19 | end 20 | 21 | if (( size(a,1) >= size(b,1) ) & ( size(a,2) >= size(b,2) )) 22 | large = a; small = b; 23 | elseif (( size(a,1) <= size(b,1) ) & ( size(a,2) <= size(b,2) )) 24 | large = b; small = a; 25 | else 26 | error('one arg must be larger than the other in both dimensions!'); 27 | end 28 | 29 | ly = size(large,1); 30 | lx = size(large,2); 31 | sy = size(small,1); 32 | sx = size(small,2); 33 | 34 | %% These values are the index of the small mtx that falls on the 35 | %% border pixel of the large matrix when computing the first 36 | %% convolution response sample: 37 | sy2 = floor((sy+ctr+1)/2); 38 | sx2 = floor((sx+ctr+1)/2); 39 | 40 | clarge = conv2(large,small); 41 | c = clarge(sy2:ly+sy2-1, sx2:lx+sx2-1); 42 | -------------------------------------------------------------------------------- /matlab/strred/run_strred.m: -------------------------------------------------------------------------------- 1 | function run_strred(ref_filename, dis_filename, width, height) 2 | 3 | path(path,'./strred'); 4 | path(path,'./matlabPyrTools'); 5 | 6 | calcStrredScore(ref_filename, dis_filename, height, width); 7 | 8 | % dmos_score = rred2dmos(strred_score) 9 | 10 | end 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | -------------------------------------------------------------------------------- /matlab/strred/run_strred_opt.m: -------------------------------------------------------------------------------- 1 | function run_strred_opt(ref_filename, dis_filename, width, height) 2 | 3 | path(path, './strred'); 4 | path(path, './matlabPyrTools'); 5 | 6 | calcStrredScore_opt(ref_filename, dis_filename, height, width); 7 | 8 | end 9 | 10 | 11 | 12 | 13 | -------------------------------------------------------------------------------- /matlab/strred/strred/calcStrredScore.m: -------------------------------------------------------------------------------- 1 | function calcStrredScore(rname,dname,rows,colms) 2 | 3 | rfid = fopen(rname); 4 | dfid = fopen(dname); 5 | 6 | srred = []; 7 | trred = []; 8 | 9 | iframe = 0; 10 | while 1 11 | 12 | [yr, cbr, crr] = readframefromfid(rfid, rows, colms); 13 | [yd, cbr, crr] = readframefromfid(dfid, rows, colms); 14 | 15 | if feof(rfid) || feof(dfid) 16 | break; 17 | end 18 | 19 | % read successful, can then reshape 20 | yr = reshape(yr, rows, colms)'; 21 | yd = reshape(yd, rows, colms)'; 22 | 23 | if iframe > 0 24 | [spatial_ref temporal_ref] = extract_info(yr, yr_prev); 25 | [spatial_dis temporal_dis] = extract_info(yd, yd_prev); 26 | srred_now = mean2(abs(spatial_ref - spatial_dis)); 27 | trred_now = mean2(abs(temporal_ref - temporal_dis)); 28 | srred = [srred srred_now]; 29 | trred = [trred trred_now]; 30 | end 31 | 32 | yr_prev = yr; 33 | yd_prev = yd; 34 | iframe = iframe + 1; 35 | 36 | end 37 | 38 | fclose(rfid); 39 | fclose(dfid); 40 | 41 | srred = [srred(1) srred]; 42 | trred = [trred(1) trred]; 43 | 44 | for frame_ind = 0 : iframe - 1 45 | 46 | disp(sprintf('srred: %d %f', frame_ind, srred(frame_ind + 1))); 47 | disp(sprintf('trred: %d %f', frame_ind, trred(frame_ind + 1))); 48 | 49 | end; 50 | 51 | end -------------------------------------------------------------------------------- /matlab/strred/strred/calcStrredScore_opt.m: -------------------------------------------------------------------------------- 1 | function calcStrredScore_opt(rname, dname, rows, colms) 2 | 3 | band = 4; 4 | Nscales = 5; 5 | Nor = 6; 6 | blk = 3; 7 | sigma_nsq = 0.1; 8 | 9 | srred = []; 10 | trred = []; 11 | 12 | rfid = fopen(rname); 13 | dfid = fopen(dname); 14 | 15 | iframe = 0; 16 | while 1 17 | 18 | [yr, ~, ~] = readframefromfid(rfid, rows, colms); 19 | [yd, ~, ~] = readframefromfid(dfid, rows, colms); 20 | 21 | if feof(rfid) || feof(dfid) 22 | break; 23 | end 24 | 25 | % read successful, can then reshape 26 | yr = reshape(yr, [colms rows])'; 27 | yd = reshape(yd, [colms rows])'; 28 | 29 | if iframe > 0 30 | [srred_now, ~, trred_now, ~] = extract_info_opt(yr, yr_prev, yd, ... 31 | yd_prev, band, Nscales, Nor, ... 32 | blk, sigma_nsq); 33 | srred = [srred srred_now]; 34 | trred = [trred trred_now]; 35 | end 36 | 37 | yr_prev = yr; 38 | yd_prev = yd; 39 | iframe = iframe + 1; 40 | 41 | end 42 | 43 | fclose(rfid); 44 | fclose(dfid); 45 | 46 | srred = [srred(1) srred]; 47 | trred = [trred(1) trred]; 48 | 49 | for frame_ind = 0 : iframe - 1 50 | 51 | disp(sprintf('srred: %d %f', frame_ind, srred(frame_ind + 1))); 52 | disp(sprintf('trred: %d %f', frame_ind, trred(frame_ind + 1))); 53 | 54 | end; 55 | 56 | end -------------------------------------------------------------------------------- /matlab/strred/strred/ind2wtree.m: -------------------------------------------------------------------------------- 1 | function wtree = ind2wtree(pyr, ind) 2 | 3 | %this function is called by vifvec.m 4 | % converts the output of Eero Simoncelli's pyramid routines into subbands in a cell array 5 | C=pyr; 6 | S=ind; 7 | 8 | offset=0; 9 | numsubs=size(ind,1); 10 | for i=1:numsubs 11 | wtree{numsubs-i+1}=reshape(C(offset+1:offset+prod(S(i,:))), S(i,1),S(i,2)); 12 | offset=offset+prod(S(i,:)); 13 | end 14 | -------------------------------------------------------------------------------- /matlab/strred/strred/readframefromfid.m: -------------------------------------------------------------------------------- 1 | function [y,cb,cr]=readframefromfid(fid,height,width) 2 | 3 | % for now, read yuv420p only 4 | 5 | y=fread(fid,width*height, 'uchar')'; 6 | cb=fread(fid,width*height/4, 'uchar')'; 7 | cr=fread(fid,width*height/4, 'uchar')'; 8 | 9 | end -------------------------------------------------------------------------------- /matlab/strred/strred/rred2dmos.m: -------------------------------------------------------------------------------- 1 | function dmos=rred2dmos(rred) 2 | dmos=16.4769+9.7111*log(1+rred/0.6444); -------------------------------------------------------------------------------- /matlab/strred/workspace/.gitignore: -------------------------------------------------------------------------------- 1 | # Ignore everything in this directory 2 | * 3 | # Except this file 4 | !.gitignore 5 | -------------------------------------------------------------------------------- /model/other_models/nflx_v1.pkl: -------------------------------------------------------------------------------- 1 | (dp0 2 | S'param_dict' 3 | p1 4 | (dp2 5 | S'C' 6 | p3 7 | F1.0 8 | sS'norm_type' 9 | p4 10 | S'clip_0to1' 11 | p5 12 | sS'score_clip' 13 | p6 14 | (lp7 15 | F0.0 16 | aF100.0 17 | asS'cache_size' 18 | p8 19 | I200 20 | sS'nu' 21 | p9 22 | F0.5 23 | sS'gamma' 24 | p10 25 | F0.85 26 | ssS'model_dict' 27 | p11 28 | (dp12 29 | g4 30 | S'linear_rescale' 31 | p13 32 | sg6 33 | g7 34 | sS'feature_names' 35 | p14 36 | (lp15 37 | S'VMAF_feature_adm_score' 38 | p16 39 | aS'VMAF_feature_ansnr_score' 40 | p17 41 | aS'VMAF_feature_motion_score' 42 | p18 43 | aS'VMAF_feature_vif_score' 44 | p19 45 | asS'intercepts' 46 | p20 47 | (lp21 48 | F-0.1909090909090909 49 | aF-1.635828565827225 50 | aF-0.5027725296167747 51 | aF-0.022214587359292954 52 | aF-0.12191917348723096 53 | asS'model_type' 54 | p22 55 | S'LIBSVMNUSVR' 56 | p23 57 | sS'slopes' 58 | p24 59 | (lp25 60 | F0.010909090909090908 61 | aF2.635828565827225 62 | aF0.030306790717580585 63 | aF0.06846153126171134 64 | aF1.121919173487231 65 | asS'model' 66 | p26 67 | Nss. -------------------------------------------------------------------------------- /model/other_models/nflx_vmaff_rf_v2.pkl: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Netflix/vmaf/b9ac69e6c4231fad0465021f9e31a841a18261db/model/other_models/nflx_vmaff_rf_v2.pkl -------------------------------------------------------------------------------- /model/other_models/nflxall_libsvmnusvr_currentbest.pkl: -------------------------------------------------------------------------------- 1 | (dp0 2 | S'param_dict' 3 | p1 4 | (dp2 5 | S'norm_type' 6 | p3 7 | S'clip_0to1' 8 | p4 9 | sS'score_clip' 10 | p5 11 | (lp6 12 | F0.0 13 | aF100.0 14 | asS'C' 15 | p7 16 | F3.1 17 | sS'nu' 18 | p8 19 | F0.9 20 | sS'gamma' 21 | p9 22 | F0.1 23 | ssS'model_dict' 24 | p10 25 | (dp11 26 | S'feature_dict' 27 | p12 28 | (dp13 29 | S'VMAF_feature' 30 | p14 31 | (lp15 32 | S'vif' 33 | p16 34 | aS'adm' 35 | p17 36 | aS'motion' 37 | p18 38 | aS'ansnr' 39 | p19 40 | assg3 41 | S'linear_rescale' 42 | p20 43 | sg5 44 | g6 45 | sS'feature_names' 46 | p21 47 | (lp22 48 | S'VMAF_feature_adm_score' 49 | p23 50 | aS'VMAF_feature_ansnr_score' 51 | p24 52 | aS'VMAF_feature_motion_score' 53 | p25 54 | aS'VMAF_feature_vif_score' 55 | p26 56 | asS'intercepts' 57 | p27 58 | (lp28 59 | F-0.14912280701754385 60 | aF-1.635828565827225 61 | aF-0.5027725296167747 62 | aF-0.017141728475754268 63 | aF-0.12191917348723096 64 | asS'model_type' 65 | p29 66 | S'LIBSVMNUSVR' 67 | p30 68 | sS'model' 69 | p31 70 | NsS'slopes' 71 | p32 72 | (lp33 73 | F0.010526315789473684 74 | aF2.635828565827225 75 | aF0.030306790717580585 76 | aF0.05282785410063858 77 | aF1.121919173487231 78 | ass. -------------------------------------------------------------------------------- /model/other_models/nflxall_vmafv1.pkl: -------------------------------------------------------------------------------- 1 | (dp0 2 | S'param_dict' 3 | p1 4 | (dp2 5 | S'norm_type' 6 | p3 7 | S'clip_0to1' 8 | p4 9 | sS'score_clip' 10 | p5 11 | (lp6 12 | F0.0 13 | aF100.0 14 | asS'C' 15 | p7 16 | F3.1 17 | sS'nu' 18 | p8 19 | F0.9 20 | sS'gamma' 21 | p9 22 | F0.1 23 | ssS'model_dict' 24 | p10 25 | (dp11 26 | S'feature_dict' 27 | p12 28 | (dp13 29 | S'VMAF_feature' 30 | p14 31 | (lp15 32 | S'vif' 33 | p16 34 | aS'adm' 35 | p17 36 | aS'motion' 37 | p18 38 | aS'ansnr' 39 | p19 40 | assg3 41 | S'linear_rescale' 42 | p20 43 | sg5 44 | g6 45 | sS'feature_names' 46 | p21 47 | (lp22 48 | S'VMAF_feature_adm_score' 49 | p23 50 | aS'VMAF_feature_ansnr_score' 51 | p24 52 | aS'VMAF_feature_motion_score' 53 | p25 54 | aS'VMAF_feature_vif_score' 55 | p26 56 | asS'intercepts' 57 | p27 58 | (lp28 59 | F-0.14912280701754385 60 | aF-1.635828565827225 61 | aF-0.5027725296167747 62 | aF-0.017141728475754268 63 | aF-0.12191917348723096 64 | asS'model_type' 65 | p29 66 | S'LIBSVMNUSVR' 67 | p30 68 | sS'model' 69 | p31 70 | NsS'slopes' 71 | p32 72 | (lp33 73 | F0.010526315789473684 74 | aF2.635828565827225 75 | aF0.030306790717580585 76 | aF0.05282785410063858 77 | aF1.121919173487231 78 | ass. -------------------------------------------------------------------------------- /model/other_models/nflxtrain_libsvmnusvr_currentbest.pkl: -------------------------------------------------------------------------------- 1 | (dp0 2 | S'param_dict' 3 | p1 4 | (dp2 5 | S'norm_type' 6 | p3 7 | S'clip_0to1' 8 | p4 9 | sS'score_clip' 10 | p5 11 | (lp6 12 | F0.0 13 | aF100.0 14 | asS'C' 15 | p7 16 | F3.1 17 | sS'nu' 18 | p8 19 | F0.9 20 | sS'gamma' 21 | p9 22 | F0.1 23 | ssS'model_dict' 24 | p10 25 | (dp11 26 | S'feature_dict' 27 | p12 28 | (dp13 29 | S'VMAF_feature' 30 | p14 31 | (lp15 32 | S'vif' 33 | p16 34 | aS'adm' 35 | p17 36 | aS'motion' 37 | p18 38 | aS'ansnr' 39 | p19 40 | assg3 41 | S'linear_rescale' 42 | p20 43 | sg5 44 | g6 45 | sS'feature_names' 46 | p21 47 | (lp22 48 | S'VMAF_feature_adm_score' 49 | p23 50 | aS'VMAF_feature_ansnr_score' 51 | p24 52 | aS'VMAF_feature_motion_score' 53 | p25 54 | aS'VMAF_feature_vif_score' 55 | p26 56 | asS'intercepts' 57 | p27 58 | (lp28 59 | F-0.1909090909090909 60 | aF-1.635828565827225 61 | aF-0.5027725296167747 62 | aF-0.022214587359292954 63 | aF-0.12191917348723096 64 | asS'model_type' 65 | p29 66 | S'LIBSVMNUSVR' 67 | p30 68 | sS'model' 69 | p31 70 | NsS'slopes' 71 | p32 72 | (lp33 73 | F0.010909090909090908 74 | aF2.635828565827225 75 | aF0.030306790717580585 76 | aF0.06846153126171134 77 | aF1.121919173487231 78 | ass. -------------------------------------------------------------------------------- /model/other_models/nflxtrain_norm_type_none.pkl: -------------------------------------------------------------------------------- 1 | (dp0 2 | S'param_dict' 3 | p1 4 | (dp2 5 | S'C' 6 | p3 7 | F4.0 8 | sS'norm_type' 9 | p4 10 | S'none' 11 | p5 12 | sS'score_clip' 13 | p6 14 | (lp7 15 | F0.0 16 | aF100.0 17 | asS'custom_clip_0to1_map' 18 | p8 19 | (dp9 20 | S'VMAF_feature_adm_scale0_score' 21 | p10 22 | (lp11 23 | F0.0 24 | aF0.5 25 | assS'nu' 26 | p12 27 | F0.9 28 | sS'gamma' 29 | p13 30 | F0.05 31 | ssS'model_dict' 32 | p14 33 | (dp15 34 | g4 35 | g5 36 | sg6 37 | g7 38 | sS'feature_names' 39 | p16 40 | (lp17 41 | S'VMAF_feature_adm2_score' 42 | p18 43 | aS'VMAF_feature_motion_score' 44 | p19 45 | aS'VMAF_feature_vif_scale0_score' 46 | p20 47 | aS'VMAF_feature_vif_scale1_score' 48 | p21 49 | aS'VMAF_feature_vif_scale2_score' 50 | p22 51 | aS'VMAF_feature_vif_scale3_score' 52 | p23 53 | asS'model_type' 54 | p24 55 | S'LIBSVMNUSVR' 56 | p25 57 | sS'model' 58 | p26 59 | NsS'feature_dict' 60 | p27 61 | (dp28 62 | S'VMAF_feature' 63 | p29 64 | (lp30 65 | S'vif_scale0' 66 | p31 67 | aS'vif_scale1' 68 | p32 69 | aS'vif_scale2' 70 | p33 71 | aS'vif_scale3' 72 | p34 73 | aS'adm2' 74 | p35 75 | aS'motion' 76 | p36 77 | asss. -------------------------------------------------------------------------------- /model/other_models/nflxtrain_vmafv1.pkl: -------------------------------------------------------------------------------- 1 | (dp0 2 | S'param_dict' 3 | p1 4 | (dp2 5 | S'norm_type' 6 | p3 7 | S'clip_0to1' 8 | p4 9 | sS'score_clip' 10 | p5 11 | (lp6 12 | F0.0 13 | aF100.0 14 | asS'C' 15 | p7 16 | F3.1 17 | sS'nu' 18 | p8 19 | F0.9 20 | sS'gamma' 21 | p9 22 | F0.1 23 | ssS'model_dict' 24 | p10 25 | (dp11 26 | S'feature_dict' 27 | p12 28 | (dp13 29 | S'VMAF_feature' 30 | p14 31 | (lp15 32 | S'vif' 33 | p16 34 | aS'adm' 35 | p17 36 | aS'motion' 37 | p18 38 | aS'ansnr' 39 | p19 40 | assg3 41 | S'linear_rescale' 42 | p20 43 | sg5 44 | g6 45 | sS'feature_names' 46 | p21 47 | (lp22 48 | S'VMAF_feature_adm_score' 49 | p23 50 | aS'VMAF_feature_ansnr_score' 51 | p24 52 | aS'VMAF_feature_motion_score' 53 | p25 54 | aS'VMAF_feature_vif_score' 55 | p26 56 | asS'intercepts' 57 | p27 58 | (lp28 59 | F-0.1909090909090909 60 | aF-1.635828565827225 61 | aF-0.5027725296167747 62 | aF-0.022214587359292954 63 | aF-0.12191917348723096 64 | asS'model_type' 65 | p29 66 | S'LIBSVMNUSVR' 67 | p30 68 | sS'model' 69 | p31 70 | NsS'slopes' 71 | p32 72 | (lp33 73 | F0.010909090909090908 74 | aF2.635828565827225 75 | aF0.030306790717580585 76 | aF0.06846153126171134 77 | aF1.121919173487231 78 | ass. -------------------------------------------------------------------------------- /model/other_models/niqe_v0.1.pkl: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Netflix/vmaf/b9ac69e6c4231fad0465021f9e31a841a18261db/model/other_models/niqe_v0.1.pkl -------------------------------------------------------------------------------- /model/vmaf_float_v0.6.1neg.pkl: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Netflix/vmaf/b9ac69e6c4231fad0465021f9e31a841a18261db/model/vmaf_float_v0.6.1neg.pkl -------------------------------------------------------------------------------- /python/.gitignore: -------------------------------------------------------------------------------- 1 | vmaf/externals.py 2 | test/resource/icpf 3 | test/resource/mp4 4 | test/resource/test_image_yuv 5 | test/resource/test_images 6 | test/resource/yuv 7 | test/resource/tiff 8 | test/resource/y4m 9 | adm_dwt2_cy.c* 10 | -------------------------------------------------------------------------------- /python/DEVELOP.md: -------------------------------------------------------------------------------- 1 | # Development 2 | 3 | ## Testing 4 | 5 | A `tox.ini` was added to provide unit tests. Before running tests using tox, be sure to first run `make` under the root directory. 6 | 7 | Run: 8 | 9 | ``` 10 | tox 11 | ``` 12 | 13 | to run all tests. 14 | 15 | ## Test coverage 16 | 17 | If you run `tox`, a summary test coverage report will be shown in terminal, 18 | you can also see a full HTML report by looking at `.tox/coverage/index.html`. 19 | 20 | This report can be useful to spot any key part of the code that was not exercised (and thus possibly likely to fail under python3) 21 | -------------------------------------------------------------------------------- /python/README.rst: -------------------------------------------------------------------------------- 1 | VMAF - Video Multimethod Assessment Fusion 2 | ========================================== 3 | 4 | .. image:: https://travis-ci.org/Netflix/vmaf.svg?branch=master 5 | :target: https://travis-ci.org/Netflix/vmaf 6 | :alt: Travis Build Status 7 | 8 | .. image:: https://ci.appveyor.com/api/projects/status/68i57b8ssasttngg?svg=true 9 | :target: https://ci.appveyor.com/project/li-zhi/vmaf 10 | :alt: AppVeyor Build Status 11 | 12 | VMAF is a perceptual video quality assessment algorithm developed by Netflix. 13 | 14 | VMAF Development Kit (VDK) is a software package that contains the VMAF algorithm implementation, 15 | as well as a set of tools that allows a user to train and test a custom VMAF model. 16 | -------------------------------------------------------------------------------- /python/pyproject.toml: -------------------------------------------------------------------------------- 1 | [build-system] 2 | requires = ["setuptools", "wheel", "Cython", "numpy"] 3 | -------------------------------------------------------------------------------- /python/requirements.txt: -------------------------------------------------------------------------------- 1 | numpy>=1.18.2,<2.0.0 2 | scipy>=1.4.1 3 | matplotlib>=3.2.1 4 | pandas>=1.0.3 5 | scikit-learn>=0.22.2 6 | scikit-image>=0.16.2 7 | h5py>=2.6.0 8 | sureal>=0.4.2 9 | dill>=0.3.1 10 | PyWavelets>=1.1.1 11 | python-slugify>=5.0.0 12 | libsvm-official>=3.30,<=3.32 -------------------------------------------------------------------------------- /python/test/__init__.py: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Netflix/vmaf/b9ac69e6c4231fad0465021f9e31a841a18261db/python/test/__init__.py -------------------------------------------------------------------------------- /python/test/conftest.py: -------------------------------------------------------------------------------- 1 | import pytest 2 | 3 | 4 | def pytest_collection_modifyitems(items): 5 | """ 6 | Dynamically mark tests based on their file name: 7 | - *_test.py: main test (always exercise) 8 | - *_extratest.py: exercised only when testing with ffmpeg 9 | - *_libtest.py: exercised only to test testlib 10 | """ 11 | for item in items: 12 | item.add_marker(pytest.mark.main) 13 | -------------------------------------------------------------------------------- /python/test/doctest_test.py: -------------------------------------------------------------------------------- 1 | __copyright__ = "Copyright 2016-2020, Netflix, Inc." 2 | __license__ = "BSD+Patent" 3 | 4 | """ 5 | Run embedded doctests 6 | """ 7 | 8 | import doctest 9 | 10 | from vmaf.tools import misc 11 | # from vmaf.tools import stats 12 | from vmaf.core import quality_runner 13 | from vmaf.core import train_test_model 14 | 15 | def load_tests(loader, tests, ignore): 16 | tests.addTests(doctest.DocTestSuite(misc)) 17 | # tests.addTests(doctest.DocTestSuite(stats)) # commented out because not numerically exact 18 | tests.addTests(doctest.DocTestSuite(quality_runner)) 19 | tests.addTests(doctest.DocTestSuite(train_test_model)) 20 | return tests 21 | -------------------------------------------------------------------------------- /python/test/requirements.txt: -------------------------------------------------------------------------------- 1 | pytest-cov 2 | -------------------------------------------------------------------------------- /python/test/resource/data_Toyama.mat: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Netflix/vmaf/b9ac69e6c4231fad0465021f9e31a841a18261db/python/test/resource/data_Toyama.mat -------------------------------------------------------------------------------- /python/test/resource/dataset_sample.py: -------------------------------------------------------------------------------- 1 | dataset_name = 'example' 2 | 3 | yuv_fmt = 'yuv420p' 4 | width = 1920 5 | height = 1080 6 | 7 | from vmaf.config import VmafConfig 8 | 9 | ref_videos = [ 10 | {'content_id': 0, 'path': VmafConfig.test_resource_path('yuv', 'checkerboard_1920_1080_10_3_0_0.yuv')}, 11 | 12 | {'content_id': 1, 'path': VmafConfig.test_resource_path('yuv', 'flat_1920_1080_0.yuv')}, 13 | ] 14 | 15 | dis_videos = [ 16 | {'content_id': 0, 'asset_id': 0, 'dmos': 100, 'path': VmafConfig.test_resource_path('yuv', 'checkerboard_1920_1080_10_3_0_0.yuv')}, # ref 17 | {'content_id': 0, 'asset_id': 1, 'dmos': 50, 'path': VmafConfig.test_resource_path('yuv', 'checkerboard_1920_1080_10_3_1_0.yuv')}, 18 | 19 | {'content_id': 1, 'asset_id': 2, 'dmos': 100, 'path': VmafConfig.test_resource_path('yuv', 'flat_1920_1080_0.yuv')}, # ref 20 | {'content_id': 1, 'asset_id': 3, 'dmos': 80, 'path': VmafConfig.test_resource_path('yuv', 'flat_1920_1080_10.yuv')}, 21 | ] 22 | -------------------------------------------------------------------------------- /python/test/resource/example_batch_input: -------------------------------------------------------------------------------- 1 | # yuv_fmt width height ref_path src_path 2 | yuv420p 576 324 python/test/resource/yuv/src01_hrc00_576x324.yuv python/test/resource/yuv/src01_hrc01_576x324.yuv 3 | yuv420p 576 324 python/test/resource/yuv/src01_hrc00_576x324.yuv python/test/resource/yuv/src01_hrc00_576x324.yuv 4 | 5 | # repeat 6 | yuv420p 576 324 python/test/resource/yuv/src01_hrc00_576x324.yuv python/test/resource/yuv/src01_hrc01_576x324.yuv 7 | yuv420p 576 324 python/test/resource/yuv/src01_hrc00_576x324.yuv python/test/resource/yuv/src01_hrc00_576x324.yuv 8 | -------------------------------------------------------------------------------- /python/test/resource/example_dataset.py: -------------------------------------------------------------------------------- 1 | dataset_name = 'example' 2 | 3 | yuv_fmt = 'yuv420p' 4 | width = 1920 5 | height = 1080 6 | 7 | from vmaf.config import VmafConfig 8 | 9 | ref_videos = [ 10 | {'content_id': 0, 'path': VmafConfig.test_resource_path('yuv', 'checkerboard_1920_1080_10_3_0_0.yuv')}, 11 | 12 | {'content_id': 1, 'path': VmafConfig.test_resource_path('yuv', 'flat_1920_1080_0.yuv')}, 13 | ] 14 | 15 | dis_videos = [ 16 | {'content_id': 0, 'asset_id': 0, 'dmos': 100, 'path': VmafConfig.test_resource_path('yuv', 'checkerboard_1920_1080_10_3_0_0.yuv')}, # ref 17 | {'content_id': 0, 'asset_id': 1, 'dmos': 50, 'path': VmafConfig.test_resource_path('yuv', 'checkerboard_1920_1080_10_3_1_0.yuv')}, 18 | 19 | {'content_id': 1, 'asset_id': 2, 'dmos': 100, 'path': VmafConfig.test_resource_path('yuv', 'flat_1920_1080_0.yuv')}, # ref 20 | {'content_id': 1, 'asset_id': 3, 'dmos': 80, 'path': VmafConfig.test_resource_path('yuv', 'flat_1920_1080_10.yuv')}, 21 | ] 22 | -------------------------------------------------------------------------------- /python/test/resource/example_dataset_crop_pad.py: -------------------------------------------------------------------------------- 1 | dataset_name = 'example' 2 | 3 | yuv_fmt = 'yuv420p' 4 | width = 576 5 | height = 324 6 | quality_width = 576 7 | quality_height = 324 8 | 9 | from vmaf.config import VmafConfig 10 | 11 | ref_videos = [ 12 | {'content_id': 0, 'path': VmafConfig.resource_path('yuv', 'src01_hrc00_576x324.yuv')}, 13 | ] 14 | 15 | dis_videos = [ 16 | {'content_id': 0, 'asset_id': 1, 'dmos': 50, 'path': VmafConfig.resource_path('yuv', 'src01_hrc01_576x324.yuv'), 'crop_cmd': '288:162:144:81'}, 17 | {'content_id': 0, 'asset_id': 2, 'dmos': 49, 'path': VmafConfig.resource_path('yuv', 'src01_hrc01_576x324.yuv'), 'pad_cmd': 'iw+100:ih+100:50:50'}, 18 | {'content_id': 0, 'asset_id': 3, 'dmos': 48, 'path': VmafConfig.resource_path('yuv', 'src01_hrc01_576x324.yuv'), 'crop_cmd': '288:162:144:81', 'pad_cmd': 'iw+288:ih+162:144:81',}, 19 | ] 20 | -------------------------------------------------------------------------------- /python/test/resource/example_dataset_crop_pad_duration_sec.py: -------------------------------------------------------------------------------- 1 | dataset_name = 'example' 2 | 3 | yuv_fmt = 'yuv420p' 4 | width = 576 5 | height = 324 6 | quality_width = 576 7 | quality_height = 324 8 | duration_sec = 5.0 9 | 10 | from vmaf.config import VmafConfig 11 | 12 | ref_videos = [ 13 | {'content_id': 0, 'path': VmafConfig.test_resource_path('yuv', 'src01_hrc00_576x324.yuv')}, 14 | ] 15 | 16 | dis_videos = [ 17 | {'content_id': 0, 'asset_id': 1, 'dmos': 50, 'path': VmafConfig.test_resource_path('yuv', 'src01_hrc01_576x324.yuv'), 'crop_cmd': '288:162:144:81'}, 18 | {'content_id': 0, 'asset_id': 2, 'dmos': 49, 'path': VmafConfig.test_resource_path('yuv', 'src01_hrc01_576x324.yuv'), 'pad_cmd': 'iw+100:ih+100:50:50'}, 19 | {'content_id': 0, 'asset_id': 3, 'dmos': 48, 'path': VmafConfig.test_resource_path('yuv', 'src01_hrc01_576x324.yuv'), 'crop_cmd': '288:162:144:81', 'pad_cmd': 'iw+288:ih+162:144:81',}, 20 | ] 21 | -------------------------------------------------------------------------------- /python/test/resource/example_raw_dataset.py: -------------------------------------------------------------------------------- 1 | dataset_name = 'example' 2 | 3 | yuv_fmt = 'yuv420p' 4 | width = 1920 5 | height = 1080 6 | ref_score = 100.0 7 | 8 | from vmaf.config import VmafConfig 9 | 10 | ref_videos = [ 11 | {'content_id': 0, 'path': VmafConfig.test_resource_path('yuv', 'checkerboard_1920_1080_10_3_0_0.yuv')}, 12 | 13 | {'content_id': 1, 'path': VmafConfig.test_resource_path('yuv', 'flat_1920_1080_0.yuv')}, 14 | ] 15 | 16 | dis_videos = [ 17 | {'content_id': 0, 'asset_id': 0, 'os': [100, 100, 100, 100, 100], 'path': VmafConfig.test_resource_path('yuv', 'checkerboard_1920_1080_10_3_0_0.yuv')}, # ref 18 | {'content_id': 0, 'asset_id': 1, 'os': [40, 45, 50, 55, 60], 'path': VmafConfig.test_resource_path('yuv', 'checkerboard_1920_1080_10_3_1_0.yuv')}, 19 | 20 | {'content_id': 1, 'asset_id': 2, 'os': [90, 90, 90, 90, 90], 'path': VmafConfig.test_resource_path('yuv', 'flat_1920_1080_0.yuv')}, # ref 21 | {'content_id': 1, 'asset_id': 3, 'os': [70, 75, 80, 85, 90], 'path': VmafConfig.test_resource_path('yuv', 'flat_1920_1080_10.yuv')}, 22 | ] 23 | -------------------------------------------------------------------------------- /python/test/resource/example_raw_dataset2.py: -------------------------------------------------------------------------------- 1 | import os 2 | 3 | dataset_name = 'example' 4 | 5 | yuv_fmt = 'yuv420p' 6 | width = 1920 7 | height = 1080 8 | ref_score = 100.0 9 | 10 | dir = '/dir' 11 | 12 | ref_videos = [ 13 | {'content_id': 0, 'path': os.path.join(dir, 'yuv', 'checkerboard_1920_1080_10_3_0_0.yuv')}, 14 | {'content_id': 1, 'path': os.path.join(dir, 'yuv', 'flat_1920_1080_0.yuv')}, 15 | ] 16 | 17 | dis_videos = [ 18 | {'content_id': 0, 'asset_id': 0, 'os': [100, 100, 100, 100, 100], 'path': os.path.join(dir, 'yuv', 'checkerboard_1920_1080_10_3_0_0.yuv')}, # ref 19 | {'content_id': 0, 'asset_id': 1, 'os': [40, 45, 50, 55, 60], 'path': os.path.join(dir, 'yuv', 'checkerboard_1920_1080_10_3_1_0.yuv')}, 20 | 21 | {'content_id': 1, 'asset_id': 2, 'os': [90, 90, 90, 90, 90], 'path': os.path.join(dir, 'yuv', 'flat_1920_1080_0.yuv')}, # ref 22 | {'content_id': 1, 'asset_id': 3, 'os': [70, 75, 80, 85, 90], 'path': os.path.join(dir, 'yuv', 'flat_1920_1080_10.yuv')}, 23 | ] 24 | -------------------------------------------------------------------------------- /python/test/resource/example_raw_dataset3.py: -------------------------------------------------------------------------------- 1 | import os 2 | 3 | dataset_name = 'example' 4 | 5 | yuv_fmt = 'yuv420p' 6 | width = 1920 7 | height = 1080 8 | ref_score = 100.0 9 | 10 | quality_width = 1920 11 | 12 | dir = '/dir' 13 | 14 | ref_videos = [ 15 | {'content_id': 0, 'path': os.path.join(dir, 'yuv', 'checkerboard_1920_1080_10_3_0_0.yuv')}, 16 | {'content_id': 1, 'path': os.path.join(dir, 'yuv', 'flat_1920_1080_0.yuv')}, 17 | ] 18 | 19 | dis_videos = [ 20 | {'content_id': 0, 'asset_id': 0, 'os': [100, 100, 100, 100, 100], 'path': os.path.join(dir, 'yuv', 'checkerboard_1920_1080_10_3_0_0.yuv')}, # ref 21 | {'content_id': 0, 'asset_id': 1, 'os': [40, 45, 50, 55, 60], 'path': os.path.join(dir, 'yuv', 'checkerboard_1920_1080_10_3_1_0.yuv')}, 22 | 23 | {'content_id': 1, 'asset_id': 2, 'os': [90, 90, 90, 90, 90], 'path': os.path.join(dir, 'yuv', 'flat_1920_1080_0.yuv')}, # ref 24 | {'content_id': 1, 'asset_id': 3, 'os': [70, 75, 80, 85, 90], 'path': os.path.join(dir, 'yuv', 'flat_1920_1080_10.yuv')}, 25 | ] 26 | -------------------------------------------------------------------------------- /python/test/resource/example_raw_dataset4.py: -------------------------------------------------------------------------------- 1 | import os 2 | 3 | dataset_name = 'example' 4 | 5 | yuv_fmt = 'yuv420p' 6 | width = 1920 7 | height = 1080 8 | ref_score = 100.0 9 | 10 | quality_width, quality_height = 1920, 1080 11 | 12 | dir = '/dir' 13 | 14 | ref_videos = [ 15 | {'content_id': 0, 'path': os.path.join(dir, 'yuv', 'checkerboard_1920_1080_10_3_0_0.yuv')}, 16 | {'content_id': 1, 'path': os.path.join(dir, 'yuv', 'flat_1920_1080_0.yuv')}, 17 | ] 18 | 19 | dis_videos = [ 20 | {'content_id': 0, 'asset_id': 0, 'os': [100, 100, 100, 100, 100], 'path': os.path.join(dir, 'yuv', 'checkerboard_1920_1080_10_3_0_0.yuv')}, # ref 21 | {'content_id': 0, 'asset_id': 1, 'os': [40, 45, 50, 55, 60], 'path': os.path.join(dir, 'yuv', 'checkerboard_1920_1080_10_3_1_0.yuv')}, 22 | 23 | {'content_id': 1, 'asset_id': 2, 'os': [90, 90, 90, 90, 90], 'path': os.path.join(dir, 'yuv', 'flat_1920_1080_0.yuv')}, # ref 24 | {'content_id': 1, 'asset_id': 3, 'os': [70, 75, 80, 85, 90], 'path': os.path.join(dir, 'yuv', 'flat_1920_1080_10.yuv')}, 25 | ] 26 | -------------------------------------------------------------------------------- /python/test/resource/feature_param_sample.py: -------------------------------------------------------------------------------- 1 | feature_dict = { 2 | 3 | # use selected features from VmafFeatureExtractor 4 | 'VMAF_feature': ['vif', 'adm', 'motion', 'ansnr'], 5 | 6 | 'Moment_feature':['dis1st'], # use distorted video's 1st moment 7 | } 8 | -------------------------------------------------------------------------------- /python/test/resource/feature_param_sample_with_optional_dict.py: -------------------------------------------------------------------------------- 1 | feature_dict = { 2 | 3 | # use selected features from VmafFeatureExtractor 4 | 'VMAF_feature': ['vif', 'adm', 'motion', 'ansnr'], 5 | 6 | 'Moment_feature':['dis1st'], # use distorted video's 1st moment 7 | } 8 | 9 | feature_optional_dict = { 10 | 'VMAF_feature': {'adm_ref_display_height': 108000}, 11 | } 12 | -------------------------------------------------------------------------------- /python/test/resource/feature_param_sample_with_optional_dict_good.py: -------------------------------------------------------------------------------- 1 | feature_dict = { 2 | 3 | # use selected features from VmafFeatureExtractor 4 | 'VMAF_feature': ['vif', 'adm', 'motion', 'ansnr'], 5 | 6 | 'Moment_feature':['dis1st'], # use distorted video's 1st moment 7 | } 8 | 9 | feature_optional_dict = { 10 | 'VMAF_feature': {'adm_ref_display_height': 540}, 11 | } 12 | -------------------------------------------------------------------------------- /python/test/resource/model_param_sample.py: -------------------------------------------------------------------------------- 1 | model_type = "LIBSVMNUSVR" 2 | model_param_dict = { 3 | 4 | # ==== preprocess: normalize each feature ==== # 5 | 'norm_type':'clip_0to1', # rescale to within [0, 1] 6 | 7 | # ==== postprocess: clip final quality score ==== # 8 | 9 | 'score_clip':[0.0, 100.0], # clip to within [0, 100] 10 | 11 | } 12 | -------------------------------------------------------------------------------- /python/test/resource/raw_dataset_sample.py: -------------------------------------------------------------------------------- 1 | dataset_name = 'example' 2 | 3 | yuv_fmt = 'yuv420p' 4 | width = 1920 5 | height = 1080 6 | ref_score = 100.0 7 | 8 | from vmaf.config import VmafConfig 9 | 10 | ref_videos = [ 11 | {'content_id': 0, 'path': VmafConfig.test_resource_path('yuv', 'checkerboard_1920_1080_10_3_0_0.yuv')}, 12 | 13 | {'content_id': 1, 'path': VmafConfig.test_resource_path('yuv', 'flat_1920_1080_0.yuv')}, 14 | ] 15 | 16 | dis_videos = [ 17 | {'content_id': 0, 'asset_id': 0, 'os': [100, 100, 100, 100, 100], 'path': VmafConfig.test_resource_path('yuv', 'checkerboard_1920_1080_10_3_0_0.yuv')}, # ref 18 | {'content_id': 0, 'asset_id': 1, 'os': [40, 45, 50, 55, 60], 'path': VmafConfig.test_resource_path('yuv', 'checkerboard_1920_1080_10_3_1_0.yuv')}, 19 | 20 | {'content_id': 1, 'asset_id': 2, 'os': [90, 90, 90, 90, 90], 'path': VmafConfig.test_resource_path('yuv', 'flat_1920_1080_0.yuv')}, # ref 21 | {'content_id': 1, 'asset_id': 3, 'os': [70, 75, 80, 85, 90], 'path': VmafConfig.test_resource_path('yuv', 'flat_1920_1080_10.yuv')}, 22 | ] 23 | -------------------------------------------------------------------------------- /python/test/resource/result_with_none.txt: -------------------------------------------------------------------------------- 1 | {'asset_id': {0: 0, 1: 0}, 'executor_id': {0: 'STRRED_feature_V1.0', 1: 'STRRED_feature_V1.0'}, 'scores_key': {0: 'STRRED_feature_srred_scores', 1: 'STRRED_feature_trred_scores'}, 'dataset': {0: 'test', 1: 'test'}, 'asset': {0: '{"asset_dict": {"height": 324, "use_path_as_workpath": 1, "width": 576}, "asset_id": 0, "content_id": 0, "dataset": "test", "dis_path": "flat_1920_1080_10.yuv", "ref_path": "flat_1920_1080_0.yuv", "workdir": ""}', 1: '{"asset_dict": {"height": 324, "use_path_as_workpath": 1, "width": 576}, "asset_id": 0, "content_id": 0, "dataset": "test", "dis_path": "flat_1920_1080_10.yuv", "ref_path": "flat_1920_1080_0.yuv", "workdir": ""}'}, 'dis_name': {0: 'flat_1920_1080_10.yuv', 1: 'flat_1920_1080_10.yuv'}, 'scores': {0: [None, None, None, None, None, None, None, 11302.90547, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, 355.623424, None, None, None], 1: [None, None, None, None, None, None, None, 10514.716612, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, 15659.008856, None, None, None]}, 'content_id': {0: 0, 1: 0}, 'ref_name': {0: 'flat_1920_1080_0.yuv', 1: 'flat_1920_1080_0.yuv'}} -------------------------------------------------------------------------------- /python/test/resource/test_dataset.py: -------------------------------------------------------------------------------- 1 | dataset_name = 'example' 2 | 3 | yuv_fmt = 'yuv420p' 4 | width = 1920 5 | height = 1080 6 | 7 | from vmaf.config import VmafConfig 8 | 9 | ref_videos = [ 10 | {'content_id': 0, 'path': VmafConfig.resource_path('yuv', 'checkerboard_1920_1080_10_3_0_0.yuv')}, 11 | 12 | {'content_id': 1, 'path': VmafConfig.resource_path('yuv', 'flat_1920_1080_0.yuv')}, 13 | ] 14 | 15 | dis_videos = [ 16 | {'content_id': 0, 'asset_id': 0, 'dmos': 100, 'path': VmafConfig.resource_path('yuv', 'checkerboard_1920_1080_10_3_0_0.yuv')}, # ref 17 | {'content_id': 0, 'asset_id': 1, 'dmos': 50, 'path': VmafConfig.resource_path('yuv', 'checkerboard_1920_1080_10_3_1_0.yuv')}, 18 | 19 | {'content_id': 1, 'asset_id': 2, 'dmos': 100, 'path': VmafConfig.resource_path('yuv', 'flat_1920_1080_0.yuv')}, # ref 20 | {'content_id': 1, 'asset_id': 3, 'dmos': 80, 'path': VmafConfig.resource_path('yuv', 'flat_1920_1080_10.yuv')}, 21 | ] 22 | -------------------------------------------------------------------------------- /python/test/resource/test_dataset_bad_fps_rebufinds.py: -------------------------------------------------------------------------------- 1 | dataset_name = 'example' 2 | 3 | quality_width = 1920 4 | quality_height = 1080 5 | 6 | from vmaf.config import VmafConfig 7 | 8 | ref_videos = [ 9 | {'content_id': 0, 'path': VmafConfig.resource_path('yuv', 'checkerboard_1920_1080_10_3_0_0.yuv'), 'yuv_fmt': 'yuv420p'}, 10 | ] 11 | 12 | dis_videos = [ 13 | {'content_id': 0, 'asset_id': 0, 'dmos': 100, 'path': VmafConfig.resource_path('yuv', 'checkerboard_1920_1080_10_3_0_0.yuv'), 'fps': -10, 'rebuf_indices': [0, 4, 15]}, # ref, make up fps and rebuf indices 14 | ] -------------------------------------------------------------------------------- /python/test/resource/test_dataset_diffyuv.py: -------------------------------------------------------------------------------- 1 | dataset_name = 'example' 2 | 3 | from vmaf.config import VmafConfig 4 | 5 | ref_videos = [ 6 | {'content_id': 0, 'path': VmafConfig.resource_path('yuv', 'checkerboard_1920_1080_10_3_0_0.yuv'), 'width': 1920, 'height': 1080, 'yuv_fmt': 'yuv420p'}, 7 | 8 | {'content_id': 1, 'path': VmafConfig.resource_path('yuv', 'flat_1280_720_0.yuv'), 'width': 1280, 'height': 720, 'yuv_fmt': 'yuv420p10le'}, 9 | ] 10 | 11 | dis_videos = [ 12 | {'content_id': 0, 'asset_id': 0, 'groundtruth': 100, 'path': VmafConfig.resource_path('yuv', 'checkerboard_1920_1080_10_3_0_0.yuv')}, # ref 13 | {'content_id': 0, 'asset_id': 1, 'groundtruth': 50, 'path': VmafConfig.resource_path('yuv', 'checkerboard_1920_1080_10_3_1_0.yuv')}, 14 | 15 | {'content_id': 1, 'asset_id': 2, 'groundtruth': 100, 'path': VmafConfig.resource_path('yuv', 'flat_1280_720_0.yuv')}, # ref 16 | {'content_id': 1, 'asset_id': 3, 'groundtruth': 80, 'path': VmafConfig.resource_path('yuv', 'flat_1280_720_10.yuv')}, 17 | ] 18 | -------------------------------------------------------------------------------- /python/test/resource/test_dataset_fps_bad_rebufinds.py: -------------------------------------------------------------------------------- 1 | dataset_name = 'example' 2 | 3 | quality_width = 1920 4 | quality_height = 1080 5 | 6 | from vmaf.config import VmafConfig 7 | 8 | ref_videos = [ 9 | {'content_id': 0, 'path': VmafConfig.resource_path('yuv', 'checkerboard_1920_1080_10_3_0_0.yuv'), 'yuv_fmt': 'yuv420p'}, 10 | ] 11 | 12 | dis_videos = [ 13 | {'content_id': 0, 'asset_id': 0, 'dmos': 100, 'path': VmafConfig.resource_path('yuv', 'checkerboard_1920_1080_10_3_0_0.yuv'), 'fps': 30, 'rebuf_indices': [0, -4, 15]}, # ref, make up fps and rebuf indices 14 | ] -------------------------------------------------------------------------------- /python/test/resource/test_dataset_fps_rebufinds.py: -------------------------------------------------------------------------------- 1 | dataset_name = 'example' 2 | 3 | quality_width = 1920 4 | quality_height = 1080 5 | 6 | from vmaf.config import VmafConfig 7 | 8 | ref_videos = [ 9 | {'content_id': 0, 'path': VmafConfig.resource_path('yuv', 'checkerboard_1920_1080_10_3_0_0.yuv'), 'yuv_fmt': 'yuv420p'}, 10 | ] 11 | 12 | dis_videos = [ 13 | {'content_id': 0, 'asset_id': 0, 'dmos': 100, 'path': VmafConfig.resource_path('yuv', 'checkerboard_1920_1080_10_3_0_0.yuv'), 'fps': 30, 'rebuf_indices': [0, 4, 15]}, # ref, make up fps and rebuf indices 14 | ] -------------------------------------------------------------------------------- /python/test/resource/test_dataset_mixed.py: -------------------------------------------------------------------------------- 1 | dataset_name = 'example' 2 | 3 | quality_width = 1920 4 | quality_height = 1080 5 | 6 | from vmaf.config import VmafConfig 7 | 8 | ref_videos = [ 9 | {'content_id': 0, 'path': VmafConfig.resource_path('yuv', 'checkerboard_1920_1080_10_3_0_0.yuv'), 'yuv_fmt': 'yuv420p', 'width': 1920, 'height': 1080}, 10 | 11 | {'content_id': 1, 'path': VmafConfig.resource_path('yuv', 'flat_1920_1080_0.yuv'), 'yuv_fmt': 'yuv420p', 'width': 720, 'height': 480}, 12 | ] 13 | 14 | dis_videos = [ 15 | {'content_id': 0, 'asset_id': 0, 'dmos': 100, 'path': VmafConfig.resource_path('yuv', 'checkerboard_1920_1080_10_3_0_0.yuv'), 'yuv_fmt': 'yuv420p', 'width': 1920, 'height': 1080}, # ref 16 | {'content_id': 0, 'asset_id': 1, 'dmos': 50, 'path': VmafConfig.resource_path('yuv', 'checkerboard_1920_1080_10_3_1_0.264'), 'yuv_fmt': 'notyuv',}, 17 | 18 | {'content_id': 1, 'asset_id': 2, 'dmos': 100, 'path': VmafConfig.resource_path('yuv', 'flat_1920_1080_0.yuv'), 'yuv_fmt': 'yuv420p', 'width': 720, 'height': 480}, # ref 19 | {'content_id': 1, 'asset_id': 3, 'dmos': 80, 'path': VmafConfig.resource_path('yuv', 'flat_1920_1080_10.264'), 'yuv_fmt': 'notyuv',}, 20 | ] 21 | -------------------------------------------------------------------------------- /python/test/resource/test_image_dataset_notyuv.py: -------------------------------------------------------------------------------- 1 | dataset_name = 'example_image' 2 | 3 | yuv_fmt = 'notyuv' 4 | quality_width = 1920 5 | quality_height = 1080 6 | 7 | from vmaf.config import VmafConfig 8 | 9 | ref_videos = [ 10 | {'content_id': 0, 'path': VmafConfig.resource_path('icpf', 'frame00000001.icpf')}, 11 | 12 | {'content_id': 1, 'path': VmafConfig.resource_path('icpf', 'frame00000002.icpf')}, 13 | ] 14 | 15 | dis_videos = [ 16 | {'content_id': 0, 'asset_id': 0, 'dmos': 100, 'path': VmafConfig.resource_path('icpf', 'frame00000000.icpf')}, # ref 17 | {'content_id': 0, 'asset_id': 1, 'dmos': 50, 'path': VmafConfig.resource_path('icpf', 'frame00000001.icpf')}, 18 | 19 | {'content_id': 1, 'asset_id': 2, 'dmos': 100, 'path': VmafConfig.resource_path('icpf', 'frame00000002.icpf')}, # ref 20 | {'content_id': 1, 'asset_id': 3, 'dmos': 80, 'path': VmafConfig.resource_path('icpf', 'frame00000003.icpf')}, 21 | ] 22 | 23 | 24 | -------------------------------------------------------------------------------- /python/test/resource/test_image_dataset_notyuv_workfile_yuv_type.py: -------------------------------------------------------------------------------- 1 | dataset_name = 'example_image' 2 | 3 | yuv_fmt = 'notyuv' 4 | quality_width = 1920 5 | quality_height = 1080 6 | workfile_yuv_type = 'yuv444p' 7 | 8 | from vmaf.config import VmafConfig 9 | 10 | ref_videos = [ 11 | {'content_id': 0, 'path': VmafConfig.resource_path('icpf', 'frame00000001.icpf')}, 12 | 13 | {'content_id': 1, 'path': VmafConfig.resource_path('icpf', 'frame00000002.icpf')}, 14 | ] 15 | 16 | dis_videos = [ 17 | {'content_id': 0, 'asset_id': 0, 'dmos': 100, 'path': VmafConfig.resource_path('icpf', 'frame00000000.icpf')}, # ref 18 | {'content_id': 0, 'asset_id': 1, 'dmos': 50, 'path': VmafConfig.resource_path('icpf', 'frame00000001.icpf')}, 19 | 20 | {'content_id': 1, 'asset_id': 2, 'dmos': 100, 'path': VmafConfig.resource_path('icpf', 'frame00000002.icpf')}, # ref 21 | {'content_id': 1, 'asset_id': 3, 'dmos': 80, 'path': VmafConfig.resource_path('icpf', 'frame00000003.icpf')}, 22 | ] 23 | 24 | 25 | -------------------------------------------------------------------------------- /python/test/resource/test_read_dataset_dataset.py: -------------------------------------------------------------------------------- 1 | import os 2 | 3 | dataset_name = 'DBName' 4 | quality_width = 1280 5 | quality_height = 1920 6 | start_frame = 200 7 | end_frame = 210 8 | 9 | root_dir = "" 10 | 11 | ref_videos = [ 12 | {'content_id': 0, 'content_name': 'XXX360', 'path': os.path.join(root_dir, 'XXX360Ref.mkv'), 13 | 'yuv_fmt': 'notyuv'} 14 | ] 15 | 16 | dis_videos = [ 17 | 18 | {'asset_id': 3, 'content_id': 0, 'path': os.path.join(root_dir, 'XXX360Ref.mkv'), 'yuv_fmt': 'notyuv', 19 | 'groundtruth': None, 'crop_cmd': '1280:1920:0:0'}, 20 | {'asset_id': 4, 'content_id': 0, 'path': os.path.join(root_dir, 'XXX360DisScaling.mp4'), 'yuv_fmt': 'notyuv', 21 | 'groundtruth': None, 'crop_cmd': '1280:1920:0:0', 'start_frame': 100, 'end_frame': 110}, 22 | {'asset_id': 5, 'content_id': 0, 'path': os.path.join(root_dir, 'XXX360DisTiling.mp4'), 'yuv_fmt': 'notyuv', 23 | 'groundtruth': None, 'crop_cmd': '1280:1920:0:0'}, 24 | 25 | ] 26 | -------------------------------------------------------------------------------- /python/test/resource/test_read_dataset_dataset2.py: -------------------------------------------------------------------------------- 1 | import os 2 | 3 | dataset_name = 'DBName' 4 | quality_width = 1280 5 | quality_height = 1920 6 | fps = 1 7 | duration_sec = 10 8 | 9 | root_dir = "" 10 | 11 | ref_videos = [ 12 | {'content_id': 0, 'content_name': 'XXX360', 'path': os.path.join(root_dir, 'XXX360Ref.mkv'), 13 | 'yuv_fmt': 'notyuv'} 14 | ] 15 | 16 | dis_videos = [ 17 | 18 | {'asset_id': 3, 'content_id': 0, 'path': os.path.join(root_dir, 'XXX360Ref.mkv'), 'yuv_fmt': 'notyuv', 19 | 'groundtruth': None, 'crop_cmd': '1280:1920:0:0'}, 20 | 21 | {'asset_id': 4, 'content_id': 0, 'path': os.path.join(root_dir, 'XXX360DisScaling.mp4'), 'yuv_fmt': 'notyuv', 22 | 'groundtruth': None, 'crop_cmd': '1280:1920:0:0', 'start_frame': 100, 'end_frame': 110}, 23 | 24 | {'asset_id': 5, 'content_id': 0, 'path': os.path.join(root_dir, 'XXX360DisTiling.mp4'), 'yuv_fmt': 'notyuv', 25 | 'groundtruth': None, 'crop_cmd': '1280:1920:0:0'}, 26 | 27 | ] 28 | -------------------------------------------------------------------------------- /python/test/resource/test_read_dataset_dataset3.py: -------------------------------------------------------------------------------- 1 | import os 2 | 3 | dataset_name = 'DBName' 4 | quality_width = 1280 5 | quality_height = 1920 6 | start_frame = 200 7 | end_frame = 210 8 | 9 | root_dir = "" 10 | 11 | ref_videos = [ 12 | {'content_id': 0, 'content_name': 'XXX360', 'path': os.path.join(root_dir, 'XXX360Ref.mkv'), 13 | 'yuv_fmt': 'notyuv', 'ref_start_frame': 250, 'ref_end_frame': 250} 14 | ] 15 | 16 | dis_videos = [ 17 | 18 | {'asset_id': 3, 'content_id': 0, 'path': os.path.join(root_dir, 'XXX360Ref.mkv'), 'yuv_fmt': 'notyuv', 19 | 'groundtruth': None, 'crop_cmd': '1280:1920:0:0', 'dis_start_frame': 250, 'dis_end_frame': 250}, 20 | {'asset_id': 4, 'content_id': 0, 'path': os.path.join(root_dir, 'XXX360DisScaling.mp4'), 'yuv_fmt': 'notyuv', 21 | 'groundtruth': None, 'crop_cmd': '1280:1920:0:0', 'start_frame': 100, 'end_frame': 110}, 22 | {'asset_id': 5, 'content_id': 0, 'path': os.path.join(root_dir, 'XXX360DisTiling.mp4'), 'yuv_fmt': 'notyuv', 23 | 'groundtruth': None, 'crop_cmd': '1280:1920:0:0', 'dis_start_frame': 250, 'dis_end_frame': 251}, 24 | 25 | ] 26 | -------------------------------------------------------------------------------- /python/test/resource/vmaf_float_v0.6.1neg.inconsist.pkl: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Netflix/vmaf/b9ac69e6c4231fad0465021f9e31a841a18261db/python/test/resource/vmaf_float_v0.6.1neg.inconsist.pkl -------------------------------------------------------------------------------- /python/test/resource/vmaf_v4.py: -------------------------------------------------------------------------------- 1 | feature_dict = { 2 | 3 | 'VMAF_feature': ['vif_scale0', 'vif_scale1', 'vif_scale2', 'vif_scale3', 'adm2', 'motion',], 4 | 5 | } 6 | 7 | model_type = "LIBSVMNUSVR" 8 | model_param_dict = { 9 | 10 | # ==== preprocess: normalize each feature ==== # 11 | # 'norm_type': 'none', # default: do nothing 12 | 'norm_type': 'clip_0to1', # rescale to within [0, 1] 13 | # 'norm_type': 'clip_minus1to1', # rescale to within [-1, 1] 14 | # 'norm_type': 'normalize', # rescale to mean zero and std one 15 | 16 | # ==== postprocess: clip final quality score ==== # 17 | # 'score_clip': None, # default: do nothing 18 | 'score_clip': [0.0, 100.0], # clip to within [0, 100] 19 | 20 | # ==== libsvmnusvr parameters ==== # 21 | 22 | # 'gamma': 0.0, # default 23 | 'gamma': 0.05, # vmaf_v3, vmaf_v4 24 | 25 | # 'C': 1.0, # default 26 | 'C': 4.0, # vmaf_v4 27 | 28 | # 'nu': 0.5, # default 29 | 'nu': 0.9, # vmafv4 30 | } 31 | -------------------------------------------------------------------------------- /python/test/resource/vmafplus_v6_bootstrap_test.py: -------------------------------------------------------------------------------- 1 | feature_dict = { 2 | 3 | 'VMAF_feature': ['vif_scale0', 'vif_scale1', 'vif_scale2', 'vif_scale3', 4 | 'adm2', 'motion2',], 5 | 6 | } 7 | 8 | model_type = "BOOTSTRAP_LIBSVMNUSVR" 9 | model_param_dict = { 10 | 11 | # ==== preprocess: normalize each feature ==== # 12 | 'norm_type': 'clip_0to1', # rescale to within [0, 1] 13 | 14 | # ==== postprocess: clip final quality score ==== # 15 | # 'score_clip': None, # default: do nothing 16 | 'score_clip': [0.0, 100.0], # clip to within [0, 100] 17 | 18 | # ==== postprocess: transform final quality score ==== # 19 | 'score_transform': {'p0':1.70674692, 'p1':1.72643844, 'p2':-0.00705305,}, # laptop vs. mobile transform 20 | 21 | # ==== libsvmnusvr parameters ==== # 22 | 23 | 'gamma': 0.04, 24 | 'C': 4.0, 25 | 'nu': 0.9, 26 | 27 | # ==== bootstrap parameters ==== # 28 | 29 | 'num_models': 5, 30 | } 31 | -------------------------------------------------------------------------------- /python/test/resource/vmafplus_v6_bootstrap_test2.py: -------------------------------------------------------------------------------- 1 | feature_dict = { 2 | 3 | 'VMAF_feature': ['vif_scale0', 'vif_scale1', 'vif_scale2', 'vif_scale3', 4 | 'adm2', 'motion2',], 5 | 6 | } 7 | 8 | model_type = "BOOTSTRAP_LIBSVMNUSVR" 9 | model_param_dict = { 10 | 11 | # ==== preprocess: normalize each feature ==== # 12 | 'norm_type': 'clip_0to1', # rescale to within [0, 1] 13 | 14 | # ==== postprocess: clip final quality score ==== # 15 | # 'score_clip': None, # default: do nothing 16 | 'score_clip': [0.0, 100.0], # clip to within [0, 100] 17 | 18 | # ==== postprocess: transform final quality score ==== # 19 | 'score_transform': {'p0':1.70674692, 'p1':1.72643844, 'p2':-0.00705305,}, # laptop vs. mobile transform 20 | 21 | # ==== libsvmnusvr parameters ==== # 22 | 23 | 'gamma': 0.04, 24 | 'C': 4.0, 25 | 'nu': 0.9, 26 | 27 | # ==== bootstrap parameters ==== # 28 | 29 | 'num_models': 10, 30 | } 31 | -------------------------------------------------------------------------------- /python/vmaf/core/__init__.py: -------------------------------------------------------------------------------- 1 | __copyright__ = "Copyright 2016-2020, Netflix, Inc." 2 | __license__ = "BSD+Patent" 3 | -------------------------------------------------------------------------------- /python/vmaf/core/adm_dwt2_py.py: -------------------------------------------------------------------------------- 1 | import pywt 2 | 3 | 4 | def adm_dwt2_py(a): 5 | a, ds = pywt.dwt2(a, 'db2', 'periodization') 6 | h, v, d = ds 7 | return a, v, h, d 8 | 9 | 10 | def adm_idwt2_py(a_v_h_d): 11 | a, v, h, d = a_v_h_d 12 | ds = (h, v, d) 13 | a = pywt.idwt2((a, ds), 'db2', 'periodization') 14 | return a 15 | -------------------------------------------------------------------------------- /python/vmaf/core/adm_dwt2_tools.py: -------------------------------------------------------------------------------- 1 | MAX_ALIGN = 32 2 | 3 | 4 | def ALIGN_CEIL(x): 5 | """ 6 | # ((x) + ((x) % MAX_ALIGN ? MAX_ALIGN - (x) % MAX_ALIGN : 0)) 7 | 8 | >>> ALIGN_CEIL(3) 9 | 32 10 | >>> ALIGN_CEIL(32) 11 | 32 12 | >>> ALIGN_CEIL(33) 13 | 64 14 | 15 | """ 16 | if x % MAX_ALIGN != 0: 17 | y = MAX_ALIGN - x % MAX_ALIGN 18 | else: 19 | y = 0 20 | return x + y 21 | 22 | 23 | if __name__ == '__main__': 24 | import doctest 25 | doctest.testmod() 26 | -------------------------------------------------------------------------------- /python/vmaf/core/cambi_quality_runner.py: -------------------------------------------------------------------------------- 1 | from abc import ABC 2 | 3 | from vmaf.core.cambi_feature_extractor import CambiFeatureExtractor, CambiFullReferenceFeatureExtractor 4 | from vmaf.core.quality_runner import QualityRunnerFromFeatureExtractor 5 | from vmaf.tools.decorator import override 6 | 7 | 8 | class CambiQualityRunner(QualityRunnerFromFeatureExtractor, ABC): 9 | 10 | TYPE = 'Cambi' 11 | VERSION = 'F' + CambiFeatureExtractor.VERSION 12 | 13 | @override(QualityRunnerFromFeatureExtractor) 14 | def _get_feature_extractor_class(self): 15 | return CambiFeatureExtractor 16 | 17 | @override(QualityRunnerFromFeatureExtractor) 18 | def _get_feature_key_for_score(self): 19 | return 'cambi' 20 | 21 | 22 | class CambiFullReferenceQualityRunner(QualityRunnerFromFeatureExtractor, ABC): 23 | 24 | TYPE = 'Cambi_FR' 25 | VERSION = 'F' + CambiFeatureExtractor.VERSION 26 | 27 | @override(QualityRunnerFromFeatureExtractor) 28 | def _get_feature_extractor_class(self): 29 | return CambiFullReferenceFeatureExtractor 30 | 31 | @override(QualityRunnerFromFeatureExtractor) 32 | def _get_feature_key_for_score(self): 33 | return 'cambi_full_reference' 34 | -------------------------------------------------------------------------------- /python/vmaf/core/h5py_mixin.py: -------------------------------------------------------------------------------- 1 | import h5py 2 | 3 | __copyright__ = "Copyright 2016-2020, Netflix, Inc." 4 | __license__ = "BSD+Patent" 5 | 6 | 7 | class H5pyMixin(object): 8 | """ 9 | Use a h5py file to store raw video channel or similar as features. 10 | Implementation class must have attribute optional_dict2. 11 | """ 12 | @staticmethod 13 | def open_h5py_file(h5py_filepath, mode='w'): 14 | f = h5py.File(h5py_filepath, mode) 15 | return f 16 | 17 | @staticmethod 18 | def close_h5py_file(f, mode='w'): 19 | if mode == 'w': 20 | f.flush() 21 | f.close() 22 | elif mode == 'r': 23 | f.close() 24 | else: 25 | assert False 26 | 27 | def assert_h5py_file(self): 28 | assert self.optional_dict2 is not None and 'h5py_file' in self.optional_dict2 29 | 30 | @property 31 | def h5py_file(self): 32 | return self.optional_dict2['h5py_file'] -------------------------------------------------------------------------------- /python/vmaf/core/proc_func.py: -------------------------------------------------------------------------------- 1 | __copyright__ = "Copyright 2016-2020, Netflix, Inc." 2 | __license__ = "BSD+Patent" 3 | 4 | proc_func_dict = { 5 | 'identity': lambda x: x, 6 | 'multiply': lambda x: x * 1.1, 7 | } 8 | -------------------------------------------------------------------------------- /python/vmaf/script/__init__.py: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Netflix/vmaf/b9ac69e6c4231fad0465021f9e31a841a18261db/python/vmaf/script/__init__.py -------------------------------------------------------------------------------- /python/vmaf/third_party/__init__.py: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Netflix/vmaf/b9ac69e6c4231fad0465021f9e31a841a18261db/python/vmaf/third_party/__init__.py -------------------------------------------------------------------------------- /python/vmaf/third_party/xiph/__init__.py: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Netflix/vmaf/b9ac69e6c4231fad0465021f9e31a841a18261db/python/vmaf/third_party/xiph/__init__.py -------------------------------------------------------------------------------- /python/vmaf/tools/__init__.py: -------------------------------------------------------------------------------- 1 | __copyright__ = "Copyright 2016-2020, Netflix, Inc." 2 | __license__ = "BSD+Patent" 3 | -------------------------------------------------------------------------------- /python/vmaf/tools/exceptions.py: -------------------------------------------------------------------------------- 1 | class BdRateException(Exception): 2 | pass 3 | 4 | 5 | class BdRateNotEnoughPointsException(BdRateException): 6 | """Exception raised when there are not enough points in the BD-rate calculation.""" 7 | 8 | def __init__(self, message: str = "Not enough points for BD-rate calculation; at least 4 points required"): 9 | super().__init__(message) 10 | 11 | 12 | class BdRateNoOverlapException(BdRateException): 13 | """Exception raised when there is no overlap in the BD-rate calculation.""" 14 | 15 | def __init__(self, message: str = "No overlap in BD-rate calculation"): 16 | super().__init__(message) 17 | 18 | 19 | class BdRateNonMonotonicException(BdRateException): 20 | """Exception raised for non-monotonic data in the BD-rate calculation.""" 21 | 22 | def __init__(self, message: str = "Non-monotonic data found in BD-rate calculation"): 23 | super().__init__(message) 24 | 25 | 26 | class BdRateZeroRateException(BdRateException): 27 | """Exception raised for data with zero rate in the BD-rate calculation.""" 28 | 29 | def __init__(self, message: str = "Points with zero rate found in BD-rate calculation"): 30 | super().__init__(message) 31 | -------------------------------------------------------------------------------- /python/vmaf/tools/kimchi.py: -------------------------------------------------------------------------------- 1 | # kimchi.py 2 | # For converting Python 2 pickles to Python 3 3 | # taken from https://rebeccabilbro.github.io/convert-py2-pickles-to-py3/ 4 | 5 | import os 6 | import dill 7 | import pickle 8 | import argparse 9 | 10 | 11 | def convert(old_pkl): 12 | """ 13 | Convert a Python 2 pickle to Python 3 14 | """ 15 | # Make a name for the new pickle 16 | new_pkl = os.path.splitext(os.path.basename(old_pkl))[0]+"_p3.pkl" 17 | 18 | # Convert Python 2 "ObjectType" to Python 3 object 19 | dill._dill._reverse_typemap["ObjectType"] = object 20 | 21 | # Open the pickle using latin1 encoding 22 | with open(old_pkl, "rb") as f: 23 | loaded = pickle.load(f, encoding="latin1") 24 | 25 | # Re-save as Python 3 pickle 26 | with open(new_pkl, "wb") as outfile: 27 | pickle.dump(loaded, outfile) 28 | 29 | 30 | if __name__ == "__main__": 31 | parser = argparse.ArgumentParser( 32 | description="Convert a Python 2 pickle to Python 3" 33 | ) 34 | 35 | parser.add_argument("infile", help="Python 2 pickle filename") 36 | 37 | args = parser.parse_args() 38 | 39 | convert(args.infile) 40 | -------------------------------------------------------------------------------- /python/vmaf/tools/resource/Hanley_McNeil.mat: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Netflix/vmaf/b9ac69e6c4231fad0465021f9e31a841a18261db/python/vmaf/tools/resource/Hanley_McNeil.mat -------------------------------------------------------------------------------- /python/vmaf/tools/typing_utils.py: -------------------------------------------------------------------------------- 1 | from __future__ import annotations 2 | 3 | from dataclasses import dataclass 4 | 5 | 6 | @dataclass 7 | class RdPoint: 8 | rate: float 9 | metric: float 10 | 11 | def __hash__(self) -> int: 12 | return hash((self.rate, self.metric)) 13 | -------------------------------------------------------------------------------- /resource/doc/bad_cases.md: -------------------------------------------------------------------------------- 1 | # Reporting Bad Cases 2 | 3 | Over time, we have received feedbacks on when VMAF's prediction does not reflect the expected perceptual quality of videos, either they are corner cases where VMAF fails to cover, or new application scenarios which VMAF was not initially intended for. In response to that, we have created a Google form to allow users to upload their video samples and describe their cases. The bad cases are valuable for improving future versions of VMAF. Users can opt in or out for sharing their sample videos publicly. 4 | 5 | Please submit the bad cases through [this link](https://docs.google.com/forms/d/e/1FAIpQLSdJntNoBuucMSiYoK3SDWoY1QN0yiFAi5LyEXuOyXEWJbQBtQ/viewform?usp=sf_link). 6 | -------------------------------------------------------------------------------- /resource/doc/nflx_ctc.md: -------------------------------------------------------------------------------- 1 | # NFLX CTC 2 | 3 | ## Metrics 4 | Using the versioned `--nflx_ctc` preset, the following metrics will be computed and logged. These metrics are specified according to the NFLX CTC. 5 | 6 | * PSNR 7 | * APSNR 8 | * SSIM 9 | * VMAF 10 | * VMAF NEG 11 | * CAMBI 12 | 13 | ## Usage 14 | Basic usage of the tool is described in the [`vmaf` README](../../libvmaf/tools/README.md). Use the versioned `--nflx_ctc` presets to register and configure all metrics according to the NFLX CTC. Basic usage is as follows: 15 | 16 | ``` 17 | ./build/tools/vmaf \ 18 | --reference reference.y4m \ 19 | --distorted distorted.y4m \ 20 | --nflx_ctc v1.0 \ 21 | --json \ 22 | --output output.json 23 | ``` 24 | 25 | There are also a few optional command-line settings you may find useful. 26 | * Use `--threads` to set the thread count to be used for multi-threaded computation. This will decrease the overall latency. 27 | 28 | ## Output 29 | `JSON` logging formats provide per-frame metrics, pooled metrics, and aggregate metrics. 30 | 31 | ## NFLX CTC Version History 32 | * v1.0: `--nflx_ctc v1.0` 33 | * 2023-01-01 34 | * Initial CTC release 35 | -------------------------------------------------------------------------------- /resource/doc/papers/CAMBI_PCS2021.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Netflix/vmaf/b9ac69e6c4231fad0465021f9e31a841a18261db/resource/doc/papers/CAMBI_PCS2021.pdf -------------------------------------------------------------------------------- /resource/doc/presentations/VMAF_ICIP17.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Netflix/vmaf/b9ac69e6c4231fad0465021f9e31a841a18261db/resource/doc/presentations/VMAF_ICIP17.pdf -------------------------------------------------------------------------------- /resource/doc/presentations/VQEG_SAM_2018_023_VMAF_Variability.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Netflix/vmaf/b9ac69e6c4231fad0465021f9e31a841a18261db/resource/doc/presentations/VQEG_SAM_2018_023_VMAF_Variability.pdf -------------------------------------------------------------------------------- /resource/doc/presentations/VQEG_SAM_2018_025_VMAF_4K.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Netflix/vmaf/b9ac69e6c4231fad0465021f9e31a841a18261db/resource/doc/presentations/VQEG_SAM_2018_025_VMAF_4K.pdf -------------------------------------------------------------------------------- /resource/doc/presentations/VQEG_SAM_2018_111_AnalysisToolsInVMAF.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Netflix/vmaf/b9ac69e6c4231fad0465021f9e31a841a18261db/resource/doc/presentations/VQEG_SAM_2018_111_AnalysisToolsInVMAF.pdf -------------------------------------------------------------------------------- /resource/doc/release.md: -------------------------------------------------------------------------------- 1 | Instructions for Publishing a New Release 2 | ======================== 3 | - Manually search the repo for the current version number (for example: 1.5.1) and replace it with the next version (for example: 1.5.2). 4 | - Update [CHANGELOG.md](https://github.com/Netflix/vmaf/blob/master/CHANGELOG.md) with new features and bugfixes since the last release (check against the [commit history](https://github.com/Netflix/vmaf/commits/master) between the dates and take in any significant / non-trivial changes into the "New features" and "Fixed bugs" lists). 5 | - Merge the changes above into master. At the [release](https://github.com/Netflix/vmaf/releases) page, click on `Draft a new release`, and follow the instructions. 6 | -------------------------------------------------------------------------------- /resource/doc/windows.md: -------------------------------------------------------------------------------- 1 | # Building vmaf on Windows 2 | 3 | We are going to build vmaf in Windows. These steps are in accordance with the corresponding github action for building on Windows and have been tested successfully using a Windows10 machine. They work with either `cmd` or `PowerShell`. 4 | 5 | **Note:** This guide is just to build libvmaf on Windows and not involves the python part of project as it is the same across all platforms (settings up virtual environment, ...). 6 | 7 | ## Steps 8 | 1. Install [msys2](https://www.msys2.org/) 9 | 10 | 2. Install required msys2 packages using its shell: 11 | 12 | pacman -S --noconfirm --needed mingw-w64-x86_64-nasm mingw-w64-x86_64-gcc mingw-w64-x86_64-meson mingw-w64-x86_64-ninja 13 | 14 | 3. It is assumed the final results will be in `C:/vmaf-install` (You can change it to any directory if you want). Finally setup the meson and build: 15 | 16 | 17 | cd <Vmaf project root directory> 18 | mkdir C:/vmaf-install 19 | meson setup libvmaf libvmaf/build --buildtype release --default-library static --prefix C:/vmaf-install 20 | meson install -C libvmaf/build 21 | -------------------------------------------------------------------------------- /resource/example/example_batch_input: -------------------------------------------------------------------------------- 1 | # yuv_fmt width height ref_path src_path 2 | yuv420p 576 324 python/test/resource/yuv/src01_hrc00_576x324.yuv python/test/resource/yuv/src01_hrc01_576x324.yuv 3 | yuv420p 576 324 python/test/resource/yuv/src01_hrc00_576x324.yuv python/test/resource/yuv/src01_hrc00_576x324.yuv 4 | 5 | # repeat 6 | yuv420p 576 324 python/test/resource/yuv/src01_hrc00_576x324.yuv python/test/resource/yuv/src01_hrc01_576x324.yuv 7 | yuv420p 576 324 python/test/resource/yuv/src01_hrc00_576x324.yuv python/test/resource/yuv/src01_hrc00_576x324.yuv 8 | -------------------------------------------------------------------------------- /resource/example/example_dataset.py: -------------------------------------------------------------------------------- 1 | dataset_name = 'example' 2 | 3 | yuv_fmt = 'yuv420p' 4 | width = 1920 5 | height = 1080 6 | 7 | from vmaf.config import VmafConfig 8 | 9 | ref_videos = [ 10 | {'content_id': 0, 'path': VmafConfig.test_resource_path('yuv', 'checkerboard_1920_1080_10_3_0_0.yuv')}, 11 | 12 | {'content_id': 1, 'path': VmafConfig.test_resource_path('yuv', 'flat_1920_1080_0.yuv')}, 13 | ] 14 | 15 | dis_videos = [ 16 | {'content_id': 0, 'asset_id': 0, 'dmos': 100, 'path': VmafConfig.test_resource_path('yuv', 'checkerboard_1920_1080_10_3_0_0.yuv')}, # ref 17 | {'content_id': 0, 'asset_id': 1, 'dmos': 50, 'path': VmafConfig.test_resource_path('yuv', 'checkerboard_1920_1080_10_3_1_0.yuv')}, 18 | 19 | {'content_id': 1, 'asset_id': 2, 'dmos': 100, 'path': VmafConfig.test_resource_path('yuv', 'flat_1920_1080_0.yuv')}, # ref 20 | {'content_id': 1, 'asset_id': 3, 'dmos': 80, 'path': VmafConfig.test_resource_path('yuv', 'flat_1920_1080_10.yuv')}, 21 | ] 22 | -------------------------------------------------------------------------------- /resource/example/example_raw_dataset.py: -------------------------------------------------------------------------------- 1 | dataset_name = 'example' 2 | 3 | yuv_fmt = 'yuv420p' 4 | width = 1920 5 | height = 1080 6 | ref_score = 100.0 7 | 8 | from vmaf.config import VmafConfig 9 | 10 | ref_videos = [ 11 | {'content_id': 0, 'content_name': 'checkerboard', 'path': VmafConfig.test_resource_path('yuv', 'checkerboard_1920_1080_10_3_0_0.yuv')}, 12 | 13 | {'content_id': 1, 'content_name': 'flat', 'path': VmafConfig.test_resource_path('yuv', 'flat_1920_1080_0.yuv')}, 14 | ] 15 | 16 | dis_videos = [ 17 | {'content_id': 0, 'asset_id': 0, 'os': [100, 100, 100, 100, 100], 'path': VmafConfig.test_resource_path('yuv', 'checkerboard_1920_1080_10_3_0_0.yuv')}, # ref 18 | {'content_id': 0, 'asset_id': 1, 'os': [40, 45, 50, 55, 60], 'path': VmafConfig.test_resource_path('yuv', 'checkerboard_1920_1080_10_3_1_0.yuv')}, 19 | 20 | {'content_id': 1, 'asset_id': 2, 'os': [90, 90, 90, 90, 90], 'path': VmafConfig.test_resource_path('yuv', 'flat_1920_1080_0.yuv')}, # ref 21 | {'content_id': 1, 'asset_id': 3, 'os': [70, 75, 80, 85, 90], 'path': VmafConfig.test_resource_path('yuv', 'flat_1920_1080_10.yuv')}, 22 | ] 23 | -------------------------------------------------------------------------------- /resource/example/externals.py: -------------------------------------------------------------------------------- 1 | FFMPEG_PATH = '/home/zli/Projects/stash/MCE/transcoder/builds/bin/ffmpeg' 2 | MATLAB_PATH = '/usr/local/MATLAB/R2014b/bin/matlab' 3 | -------------------------------------------------------------------------------- /resource/feature_param/ssim.py: -------------------------------------------------------------------------------- 1 | feature_dict = { 2 | 'SSIM_feature': ['ssim'], 3 | } 4 | -------------------------------------------------------------------------------- /resource/feature_param/vmaf_feature_v1.py: -------------------------------------------------------------------------------- 1 | feature_dict = { 2 | 3 | # use selected features from VmafFeatureExtractor 4 | 'VMAF_feature': ['vif', 'adm', 'motion', 'ansnr'], 5 | 6 | } 7 | -------------------------------------------------------------------------------- /resource/feature_param/vmaf_feature_v2.py: -------------------------------------------------------------------------------- 1 | feature_dict = { 2 | 3 | 'VMAF_feature': ['vif_scale0', 'vif_scale1', 'vif_scale2', 'vif_scale3', 'adm2', 'motion', 'ansnr', ], 4 | 5 | } -------------------------------------------------------------------------------- /resource/feature_param/vmaf_feature_v3.py: -------------------------------------------------------------------------------- 1 | feature_dict = { 2 | 3 | 'VMAF_feature': ['vif_scale0', 'vif_scale1', 'vif_scale2', 'vif_scale3', 'adm2', 'motion', ], 4 | 5 | } 6 | -------------------------------------------------------------------------------- /resource/feature_param/vmaf_feature_v6.py: -------------------------------------------------------------------------------- 1 | feature_dict = { 2 | 3 | 'VMAF_feature': ['vif_scale0', 'vif_scale1', 'vif_scale2', 'vif_scale3', 'adm2', 'motion2', ], 4 | 5 | } 6 | -------------------------------------------------------------------------------- /resource/images/CI.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Netflix/vmaf/b9ac69e6c4231fad0465021f9e31a841a18261db/resource/images/CI.png -------------------------------------------------------------------------------- /resource/images/phone_model.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Netflix/vmaf/b9ac69e6c4231fad0465021f9e31a841a18261db/resource/images/phone_model.png -------------------------------------------------------------------------------- /resource/images/scatter_testing.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Netflix/vmaf/b9ac69e6c4231fad0465021f9e31a841a18261db/resource/images/scatter_testing.png -------------------------------------------------------------------------------- /resource/images/scatter_training.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Netflix/vmaf/b9ac69e6c4231fad0465021f9e31a841a18261db/resource/images/scatter_training.png -------------------------------------------------------------------------------- /resource/images/subsample.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Netflix/vmaf/b9ac69e6c4231fad0465021f9e31a841a18261db/resource/images/subsample.png -------------------------------------------------------------------------------- /resource/images/uml.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Netflix/vmaf/b9ac69e6c4231fad0465021f9e31a841a18261db/resource/images/uml.png -------------------------------------------------------------------------------- /resource/images/vmaf_logo.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Netflix/vmaf/b9ac69e6c4231fad0465021f9e31a841a18261db/resource/images/vmaf_logo.jpg -------------------------------------------------------------------------------- /resource/model_param/5PL_v1.py: -------------------------------------------------------------------------------- 1 | model_type = "5PL" 2 | model_param_dict = { 3 | # ==== preprocess: normalize each feature ==== # 4 | # 'norm_type':'none', 5 | 'norm_type': 'clip_0to1', # rescale to within [0, 1] 6 | 7 | # ==== postprocess: clip final quality score ==== # 8 | 'score_clip':[0.0, 100.0], # clip to within [0, 100] 9 | } 10 | -------------------------------------------------------------------------------- /resource/model_param/libsvmnusvr_v1.py: -------------------------------------------------------------------------------- 1 | model_type = "LIBSVMNUSVR" 2 | model_param_dict = { 3 | 4 | # ==== preprocess: normalize each feature ==== # 5 | # 'norm_type': 'none', # default: do nothing 6 | 'norm_type': 'clip_0to1', # rescale to within [0, 1] 7 | # 'norm_type': 'clip_minus1to1', # rescale to within [-1, 1] 8 | # 'norm_type': 'normalize', # rescale to mean zero and std one 9 | 10 | # ==== postprocess: clip final quality score ==== # 11 | # 'score_clip': None, # default: do nothing 12 | 'score_clip': [0.0, 100.0], # clip to within [0, 100] 13 | 14 | # ==== libsvmnusvr parameters ==== # 15 | 16 | # 'gamma': 0.0, # default 17 | 'gamma': 0.1, # vmafv1 18 | 19 | # 'C': 1.0, # default 20 | 'C': 3.1, # vmafv1 21 | 22 | # 'nu': 0.5, # default 23 | 'nu': 0.9, # vmafv1 24 | } 25 | -------------------------------------------------------------------------------- /resource/model_param/libsvmnusvr_v2.py: -------------------------------------------------------------------------------- 1 | model_type = "LIBSVMNUSVR" 2 | model_param_dict = { 3 | 4 | # ==== preprocess: normalize each feature ==== # 5 | # 'norm_type': 'none', # default: do nothing 6 | 'norm_type': 'clip_0to1', # rescale to within [0, 1] 7 | # 'norm_type': 'clip_minus1to1', # rescale to within [-1, 1] 8 | # 'norm_type': 'normalize', # rescale to mean zero and std one 9 | 10 | # ==== postprocess: clip final quality score ==== # 11 | # 'score_clip': None, # default: do nothing 12 | 'score_clip': [0.0, 100.0], # clip to within [0, 100] 13 | 14 | # ==== libsvmnusvr parameters ==== # 15 | 16 | # 'gamma': 0.0, # default 17 | 'gamma': 0.05, # vmafv2 18 | 19 | # 'C': 1.0, # default 20 | 'C': 4.0, # vmafv2 21 | 22 | # 'nu': 0.5, # default 23 | 'nu': 0.9, # vmafv2 24 | } 25 | -------------------------------------------------------------------------------- /resource/model_param/libsvmnusvr_v3.py: -------------------------------------------------------------------------------- 1 | model_type = "LIBSVMNUSVR" 2 | model_param_dict = { 3 | 4 | # ==== preprocess: normalize each feature ==== # 5 | # 'norm_type': 'none', # default: do nothing 6 | 'norm_type': 'clip_0to1', # rescale to within [0, 1] 7 | # 'norm_type': 'clip_minus1to1', # rescale to within [-1, 1] 8 | # 'norm_type': 'normalize', # rescale to mean zero and std one 9 | 10 | # ==== postprocess: clip final quality score ==== # 11 | # 'score_clip': None, # default: do nothing 12 | 'score_clip': [0.0, 100.0], # clip to within [0, 100] 13 | 14 | # ==== libsvmnusvr parameters ==== # 15 | 16 | # 'gamma': 0.0, # default 17 | 'gamma': 0.05, # vmafv2 18 | 19 | # 'C': 1.0, # default 20 | 'C': 4.0, # vmafv2 21 | 22 | # 'nu': 0.5, # default 23 | 'nu': 0.9, # vmafv2 24 | } 25 | -------------------------------------------------------------------------------- /resource/model_param/randomforest_v1.py: -------------------------------------------------------------------------------- 1 | model_type = "RANDOMFOREST" 2 | model_param_dict = { 3 | 4 | # ==== preprocess: normalize each feature ==== # 5 | 'norm_type':'none', # default: do nothing - won't matter to random forest 6 | 7 | # ==== postprocess: clip final quality score 8 | # 'score_clip':None, # default: do nothing 9 | 'score_clip':[0.0, 100.0], # clip to within [0, 100] 10 | 11 | # ==== randomforest parameters ==== # 12 | 13 | 'n_estimators':10, # default 14 | 15 | 'criterion':'mse', # default 16 | 17 | 'max_depth':None, # default 18 | 19 | # 'random_state':None, # default: random 20 | 'random_state':0, # make result deterministic 21 | 22 | } 23 | -------------------------------------------------------------------------------- /resource/param/vmaf_v1.py: -------------------------------------------------------------------------------- 1 | feature_dict = { 2 | 3 | 'VMAF_feature': ['vif', 'adm', 'motion', 'ansnr'], 4 | 5 | } 6 | 7 | model_type = "LIBSVMNUSVR" 8 | model_param_dict = { 9 | 10 | # ==== preprocess: normalize each feature ==== # 11 | # 'norm_type': 'none', # default: do nothing 12 | 'norm_type': 'clip_0to1', # rescale to within [0, 1] 13 | # 'norm_type': 'clip_minus1to1', # rescale to within [-1, 1] 14 | # 'norm_type': 'normalize', # rescale to mean zero and std one 15 | 16 | # ==== postprocess: clip final quality score ==== # 17 | # 'score_clip': None, # default: do nothing 18 | 'score_clip': [0.0, 100.0], # clip to within [0, 100] 19 | 20 | # ==== libsvmnusvr parameters ==== # 21 | 22 | # 'gamma': 0.0, # default 23 | 'gamma': 0.1, # vmafv1 24 | 25 | # 'C': 1.0, # default 26 | 'C': 3.1, # vmafv1 27 | 28 | # 'nu': 0.5, # default 29 | 'nu': 0.9, # vmafv1 30 | } 31 | -------------------------------------------------------------------------------- /resource/param/vmaf_v2.py: -------------------------------------------------------------------------------- 1 | feature_dict = { 2 | 3 | 'VMAF_feature': ['vif_scale0', 'vif_scale1', 'vif_scale2', 'vif_scale3', 'adm2', 'motion', 'ansnr', ], 4 | 5 | } 6 | 7 | model_type = "LIBSVMNUSVR" 8 | model_param_dict = { 9 | 10 | # ==== preprocess: normalize each feature ==== # 11 | # 'norm_type': 'none', # default: do nothing 12 | 'norm_type': 'clip_0to1', # rescale to within [0, 1] 13 | # 'norm_type': 'clip_minus1to1', # rescale to within [-1, 1] 14 | # 'norm_type': 'normalize', # rescale to mean zero and std one 15 | 16 | # ==== postprocess: clip final quality score ==== # 17 | # 'score_clip': None, # default: do nothing 18 | 'score_clip': [0.0, 100.0], # clip to within [0, 100] 19 | 20 | # ==== libsvmnusvr parameters ==== # 21 | 22 | # 'gamma': 0.0, # default 23 | 'gamma': 0.05, # vmafv2 24 | 25 | # 'C': 1.0, # default 26 | 'C': 4.0, # vmafv2 27 | 28 | # 'nu': 0.5, # default 29 | 'nu': 0.9, # vmafv2 30 | } 31 | -------------------------------------------------------------------------------- /resource/param/vmaf_v3.py: -------------------------------------------------------------------------------- 1 | feature_dict = { 2 | 3 | 'VMAF_feature': ['vif_scale0', 'vif_scale1', 'vif_scale2', 'vif_scale3', 'adm2', 'motion', ], 4 | 5 | } 6 | 7 | model_type = "LIBSVMNUSVR" 8 | model_param_dict = { 9 | 10 | # ==== preprocess: normalize each feature ==== # 11 | # 'norm_type': 'none', # default: do nothing 12 | 'norm_type': 'clip_0to1', # rescale to within [0, 1] 13 | # 'norm_type': 'clip_minus1to1', # rescale to within [-1, 1] 14 | # 'norm_type': 'normalize', # rescale to mean zero and std one 15 | 16 | # ==== postprocess: clip final quality score ==== # 17 | # 'score_clip': None, # default: do nothing 18 | 'score_clip': [0.0, 100.0], # clip to within [0, 100] 19 | 20 | # ==== libsvmnusvr parameters ==== # 21 | 22 | # 'gamma': 0.0, # default 23 | 'gamma': 0.05, # vmafv3 24 | 25 | # 'C': 1.0, # default 26 | 'C': 4.0, # vmafv3 27 | 28 | # 'nu': 0.5, # default 29 | 'nu': 0.9, # vmafv3 30 | } 31 | -------------------------------------------------------------------------------- /resource/param/vmaf_v4.py: -------------------------------------------------------------------------------- 1 | feature_dict = { 2 | 3 | 'VMAF_feature': ['vif_scale0', 'vif_scale1', 'vif_scale2', 'vif_scale3', 'adm2', 'motion',], 4 | 5 | } 6 | 7 | model_type = "LIBSVMNUSVR" 8 | model_param_dict = { 9 | 10 | # ==== preprocess: normalize each feature ==== # 11 | # 'norm_type': 'none', # default: do nothing 12 | 'norm_type': 'clip_0to1', # rescale to within [0, 1] 13 | # 'norm_type': 'clip_minus1to1', # rescale to within [-1, 1] 14 | # 'norm_type': 'normalize', # rescale to mean zero and std one 15 | 16 | # ==== postprocess: clip final quality score ==== # 17 | # 'score_clip': None, # default: do nothing 18 | 'score_clip': [0.0, 100.0], # clip to within [0, 100] 19 | 20 | # ==== libsvmnusvr parameters ==== # 21 | 22 | # 'gamma': 0.0, # default 23 | 'gamma': 0.05, # vmaf_v3, vmaf_v4 24 | 25 | # 'C': 1.0, # default 26 | 'C': 4.0, # vmaf_v4 27 | 28 | # 'nu': 0.5, # default 29 | 'nu': 0.9, # vmafv4 30 | } 31 | -------------------------------------------------------------------------------- /resource/param/vmaf_v6.py: -------------------------------------------------------------------------------- 1 | feature_dict = { 2 | 3 | 'VMAF_feature': ['vif_scale0', 'vif_scale1', 'vif_scale2', 'vif_scale3', 4 | 'adm2', 'motion2',], 5 | 6 | } 7 | 8 | model_type = "LIBSVMNUSVR" 9 | model_param_dict = { 10 | 11 | # ==== preprocess: normalize each feature ==== # 12 | # 'norm_type': 'none', # default: do nothing 13 | 'norm_type': 'clip_0to1', # rescale to within [0, 1] 14 | # 'norm_type': 'clip_minus1to1', # rescale to within [-1, 1] 15 | # 'norm_type': 'normalize', # rescale to mean zero and std one 16 | 17 | # ==== postprocess: clip final quality score ==== # 18 | # 'score_clip': None, # default: do nothing 19 | 'score_clip': [0.0, 100.0], # clip to within [0, 100] 20 | 21 | # ==== postprocess: transform final quality score ==== # 22 | 'score_transform': {'p0':1.70674692, 'p1':1.72643844, 'p2':-0.00705305, 'out_gte_in':'true'}, # laptop vs. mobile transform 23 | 24 | # ==== libsvmnusvr parameters ==== # 25 | 26 | 'gamma': 0.04, 27 | 'C': 4.0, 28 | 'nu': 0.9, 29 | } 30 | -------------------------------------------------------------------------------- /resource/param/vmaf_v6_bootstrap.py: -------------------------------------------------------------------------------- 1 | feature_dict = { 2 | 3 | 'VMAF_feature': ['vif_scale0', 'vif_scale1', 'vif_scale2', 'vif_scale3', 4 | 'adm2', 'motion2',], 5 | 6 | } 7 | 8 | model_type = "BOOTSTRAP_LIBSVMNUSVR" 9 | model_param_dict = { 10 | 11 | # ==== preprocess: normalize each feature ==== # 12 | # 'norm_type': 'none', # default: do nothing 13 | 'norm_type': 'clip_0to1', # rescale to within [0, 1] 14 | # 'norm_type': 'clip_minus1to1', # rescale to within [-1, 1] 15 | # 'norm_type': 'normalize', # rescale to mean zero and std one 16 | 17 | # ==== postprocess: clip final quality score ==== # 18 | # 'score_clip': None, # default: do nothing 19 | 'score_clip': [0.0, 100.0], # clip to within [0, 100] 20 | 21 | # ==== postprocess: transform final quality score ==== # 22 | 'score_transform': {'p0':1.70674692, 'p1':1.72643844, 'p2':-0.00705305, 'out_gte_in':'true'}, # laptop vs. mobile transform 23 | 24 | # ==== libsvmnusvr parameters ==== # 25 | 26 | 'gamma': 0.04, 27 | 'C': 4.0, 28 | 'nu': 0.9, 29 | 30 | # ==== bootstrap parameters ==== # 31 | 32 | 'num_models': 21, # this leads to 20 bootstrapped models being trained 33 | } 34 | -------------------------------------------------------------------------------- /resource/param/vmaf_v6_residue_bootstrap.py: -------------------------------------------------------------------------------- 1 | feature_dict = { 2 | 3 | 'VMAF_feature': ['vif_scale0', 'vif_scale1', 'vif_scale2', 'vif_scale3', 4 | 'adm2', 'motion2',], 5 | 6 | } 7 | 8 | model_type = "RESIDUEBOOTSTRAP_LIBSVMNUSVR" 9 | model_param_dict = { 10 | 11 | # ==== preprocess: normalize each feature ==== # 12 | # 'norm_type': 'none', # default: do nothing 13 | 'norm_type': 'clip_0to1', # rescale to within [0, 1] 14 | # 'norm_type': 'clip_minus1to1', # rescale to within [-1, 1] 15 | # 'norm_type': 'normalize', # rescale to mean zero and std one 16 | 17 | # ==== postprocess: clip final quality score ==== # 18 | # 'score_clip': None, # default: do nothing 19 | 'score_clip': [0.0, 100.0], # clip to within [0, 100] 20 | 21 | # ==== postprocess: transform final quality score ==== # 22 | 'score_transform': {'p0':1.70674692, 'p1':1.72643844, 'p2':-0.00705305, 'out_gte_in':'true'}, # laptop vs. mobile transform 23 | 24 | # ==== libsvmnusvr parameters ==== # 25 | 26 | 'gamma': 0.04, 27 | 'C': 4.0, 28 | 'nu': 0.9, 29 | 30 | # ==== bootstrap parameters ==== # 31 | 32 | 'num_models': 21, # this leads to 20 bootstrapped models being trained 33 | } 34 | -------------------------------------------------------------------------------- /resource/param/vmaf_v7_bootstrap.py: -------------------------------------------------------------------------------- 1 | feature_dict = { 2 | 3 | 'VMAF_feature': ['vif_scale0', 'vif_scale1', 'vif_scale2', 'vif_scale3', 4 | 'adm2', 'motion2',], 5 | 6 | } 7 | 8 | model_type = "BOOTSTRAP_LIBSVMNUSVR" 9 | model_param_dict = { 10 | 11 | # ==== preprocess: normalize each feature ==== # 12 | # 'norm_type': 'none', # default: do nothing 13 | 'norm_type': 'clip_0to1', # rescale to within [0, 1] 14 | # 'norm_type': 'clip_minus1to1', # rescale to within [-1, 1] 15 | # 'norm_type': 'normalize', # rescale to mean zero and std one 16 | 17 | # ==== postprocess: clip final quality score ==== # 18 | # 'score_clip': None, # default: do nothing 19 | 'score_clip': [0.0, 100.0], # clip to within [0, 100] 20 | 21 | # ==== postprocess: transform final quality score ==== # 22 | 'score_transform': {'p0':1.70674692, 'p1':1.72643844, 'p2':-0.00705305, 'out_gte_in':'true'}, # laptop vs. mobile transform 23 | 24 | # ==== libsvmnusvr parameters ==== # 25 | 26 | 'gamma': 0.04, 27 | 'C': 4.0, 28 | 'nu': 0.9, 29 | 30 | # ==== bootstrap parameters ==== # 31 | 32 | 'num_models': 101, # this leads to 100 bootstrapped models being trained 33 | } 34 | -------------------------------------------------------------------------------- /resource/param/vmaf_v8.py: -------------------------------------------------------------------------------- 1 | feature_dict = { 2 | 3 | 'VMAF_integer_feature': ['vif_scale0', 'vif_scale1', 'vif_scale2', 'vif_scale3', 4 | 'adm2', 'motion2',], 5 | 6 | } 7 | 8 | model_type = "LIBSVMNUSVR" 9 | model_param_dict = { 10 | 11 | # ==== preprocess: normalize each feature ==== # 12 | # 'norm_type': 'none', # default: do nothing 13 | 'norm_type': 'clip_0to1', # rescale to within [0, 1] 14 | # 'norm_type': 'clip_minus1to1', # rescale to within [-1, 1] 15 | # 'norm_type': 'normalize', # rescale to mean zero and std one 16 | 17 | # ==== postprocess: clip final quality score ==== # 18 | # 'score_clip': None, # default: do nothing 19 | 'score_clip': [0.0, 100.0], # clip to within [0, 100] 20 | 21 | # ==== postprocess: transform final quality score ==== # 22 | 'score_transform': {'p0':1.70674692, 'p1':1.72643844, 'p2':-0.00705305, 'out_gte_in':'true'}, # laptop vs. mobile transform 23 | 24 | # ==== libsvmnusvr parameters ==== # 25 | 26 | 'gamma': 0.04, 27 | 'C': 4.0, 28 | 'nu': 0.9, 29 | } 30 | -------------------------------------------------------------------------------- /resource/param/vmaf_v8_bootstrap.py: -------------------------------------------------------------------------------- 1 | feature_dict = { 2 | 3 | 'VMAF_integer_feature': ['vif_scale0', 'vif_scale1', 'vif_scale2', 'vif_scale3', 4 | 'adm2', 'motion2',], 5 | 6 | } 7 | 8 | model_type = "BOOTSTRAP_LIBSVMNUSVR" 9 | model_param_dict = { 10 | 11 | # ==== preprocess: normalize each feature ==== # 12 | # 'norm_type': 'none', # default: do nothing 13 | 'norm_type': 'clip_0to1', # rescale to within [0, 1] 14 | # 'norm_type': 'clip_minus1to1', # rescale to within [-1, 1] 15 | # 'norm_type': 'normalize', # rescale to mean zero and std one 16 | 17 | # ==== postprocess: clip final quality score ==== # 18 | # 'score_clip': None, # default: do nothing 19 | 'score_clip': [0.0, 100.0], # clip to within [0, 100] 20 | 21 | # ==== postprocess: transform final quality score ==== # 22 | 'score_transform': {'p0':1.70674692, 'p1':1.72643844, 'p2':-0.00705305, 'out_gte_in':'true'}, # laptop vs. mobile transform 23 | 24 | # ==== libsvmnusvr parameters ==== # 25 | 26 | 'gamma': 0.04, 27 | 'C': 4.0, 28 | 'nu': 0.9, 29 | 30 | # ==== bootstrap parameters ==== # 31 | 32 | 'num_models': 101, # this leads to 100 bootstrapped models being trained 33 | } 34 | -------------------------------------------------------------------------------- /unittest: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env sh 2 | 3 | if [ -z "$1" ]; then 4 | pattern='*_test.py' 5 | else 6 | pattern="$1" 7 | fi 8 | 9 | PYTHONPATH=python python3 -m unittest discover -v -s python/test/ -p $pattern 10 | -------------------------------------------------------------------------------- /workspace/checkpoints_dir/.gitignore: -------------------------------------------------------------------------------- 1 | # Ignore everything in this directory 2 | * 3 | # Except this file 4 | !.gitignore 5 | -------------------------------------------------------------------------------- /workspace/dataset/.gitignore: -------------------------------------------------------------------------------- 1 | # Ignore everything in this directory 2 | * 3 | # Except this file 4 | !.gitignore 5 | -------------------------------------------------------------------------------- /workspace/encode/.gitignore: -------------------------------------------------------------------------------- 1 | # Ignore everything in this directory 2 | * 3 | # Except this file 4 | !.gitignore 5 | -------------------------------------------------------------------------------- /workspace/model/.gitignore: -------------------------------------------------------------------------------- 1 | # Ignore everything in this directory 2 | * 3 | # Except this file 4 | !.gitignore 5 | -------------------------------------------------------------------------------- /workspace/model_param/.gitignore: -------------------------------------------------------------------------------- 1 | # Ignore everything in this directory 2 | * 3 | # Except this file 4 | !.gitignore 5 | -------------------------------------------------------------------------------- /workspace/output/.gitignore: -------------------------------------------------------------------------------- 1 | # Ignore everything in this directory 2 | * 3 | # Except this file 4 | !.gitignore 5 | -------------------------------------------------------------------------------- /workspace/result_store_dir/.gitignore: -------------------------------------------------------------------------------- 1 | # Ignore everything in this directory 2 | * 3 | # Except this file 4 | !.gitignore 5 | -------------------------------------------------------------------------------- /workspace/workdir/.gitignore: -------------------------------------------------------------------------------- 1 | # Ignore everything in this directory 2 | * 3 | # Except this file 4 | !.gitignore 5 | --------------------------------------------------------------------------------