{"id":13573292,"url":"https://github.com/cloudinary/ssimulacra2","last_synced_at":"2025-12-25T01:48:25.223Z","repository":{"id":66021016,"uuid":"518375561","full_name":"cloudinary/ssimulacra2","owner":"cloudinary","description":"SSIMULACRA 2. Perceptual metric.","archived":false,"fork":false,"pushed_at":"2024-03-18T16:16:46.000Z","size":912,"stargazers_count":159,"open_issues_count":4,"forks_count":5,"subscribers_count":15,"default_branch":"main","last_synced_at":"2024-11-05T07:36:18.435Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"C++","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"bsd-3-clause","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/cloudinary.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2022-07-27T08:36:51.000Z","updated_at":"2024-10-22T04:38:35.000Z","dependencies_parsed_at":"2024-01-14T03:51:43.629Z","dependency_job_id":"0b4e0fb0-1114-4932-adc4-ec61dac17f02","html_url":"https://github.com/cloudinary/ssimulacra2","commit_stats":null,"previous_names":[],"tags_count":2,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/cloudinary%2Fssimulacra2","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/cloudinary%2Fssimulacra2/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/cloudinary%2Fssimulacra2/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/cloudinary%2Fssimulacra2/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/cloudinary","download_url":"https://codeload.github.com/cloudinary/ssimulacra2/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":247179333,"owners_count":20897017,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-08-01T15:00:32.856Z","updated_at":"2025-12-25T01:48:25.213Z","avatar_url":"https://github.com/cloudinary.png","language":"C++","funding_links":[],"categories":["C++"],"sub_categories":[],"readme":"# SSIMULACRA 2 - Structural SIMilarity Unveiling Local And Compression Related Artifacts\n\nPerceptual metric developed by Jon Sneyers (Cloudinary) in July-October 2022, updated in April 2023.\n\n## Usage\n```\nssimulacra2 original.png distorted.png\n```\n\nReturns a score in range -inf..100, which correlates to subjective visual quality scores as follows:\n\n- negative scores: extremely low quality, very strong distortion.\n- 10 = very low quality.\n  MOS score close to 1 ('bad') in a BT.500 ACR test. Very obvious and annoying artifacts.\n  This corresponds to the typical output of `cjxl -d 14` / `-q 12` or libjpeg-turbo 4:2:0 quality 14.\n- 30 = low quality.\n  MOS score around 2 ('poor') in a BT.500 ACR test. Obvious and annoying artifacts.\n  This corresponds to the typical output of `cjxl -d 9` / `-q 20` or libjpeg-turbo 4:2:0 quality 20.\n- 50 = medium quality.\n  MOS score around 3 ('fair') in a BT.500 ACR test. Slightly annoying artifacts.\n  This corresponds to the typical output of `cjxl -d 5` / `-q 45` or libjpeg-turbo 4:2:0 quality 35.\n- 70 = high quality.\n  MOS score around 4 ('good') in a BT.500 ACR test. Artifacts are perceptible, but not annoying.\n  Distortion barely noticeable by an average observer in a side-by-side comparison at 1:1 from a normal viewing distance.\n  Without reference to the original image, an average observer does not notice artifacts.\n  This corresponds to the typical output of `cjxl -d 2.5` / `-q 73` or libjpeg-turbo 4:2:0 quality 70.\n- 80 = very high quality.\n  Distortion not noticeable by an average observer in a side-by-side comparison at 1:1 from a normal viewing distance.\n  This corresponds to the typical output of `cjxl -d 1.5` / `-q 85` or libjpeg-turbo 4:2:2 quality 85.\n- 85 = excellent quality. \n  Distortion not noticeable by an average observer in the condition of in-place comparison at 1:1 from a normal viewing distance.\n  This corresponds to the typical output of `cjxl -d 1` / `-q 90` or libjpeg-turbo 4:4:4 quality 90.\n- 90 = visually lossless.\n  Distortion not noticeable by an average observer in a flicker test at 1:1 from a normal viewing distance.\n  This corresponds to the typical output of `cjxl -d 0.5` / `-q 95` or libjpeg-turbo 4:4:4 quality 95.\n- 100 = mathematically lossless.\n\n\n\n## How it works\n\nSSIMULACRA 2 is based on the concept of the multi-scale structural similarity index measure (MS-SSIM),\ncomputed in a perceptually relevant color space, adding two other (asymmetric) error maps, and\naggregating using two different norms.\n\n- XYB color space (rescaled to a 0..1 range and with B-Y)\n- Three error maps:\n  - SSIM map (with a corrected SSIM formula that avoids applying gamma correction twice)\n  - 'blockiness/ringing' map (error means distorted has edges where original is smooth)\n  - 'smoothing/blur' map (error means distorted is smooth where original has edges)\n- Each of these error maps is computed at 6 scales (1:1 to 1:32) for each component (X,Y,B)\n- Downscaling is done in linear color (i.e. the perceptually correct way)\n- For each of these `6*3*3=54` maps, two norms are computed: 1-norm (mean) and 4-norm\n- A weighted sum of these `54*2=108` norms leads to the final score\n- Weights were tuned based on a large set of subjective scores (CID22, TID2013, Kadid10k, KonFiG-IQA),\n  including images compressed with JPEG, JPEG 2000, JPEG XL, WebP, AVIF, HEIC, and various artificial distortions.\n\n\nFinal results after tuning:\n\nSSIMULACRA 2.1:\n\nDataset | KRCC | SRCC | PCC |\n-- | -- | -- | --\nCID22|     0.6903 | 0.8805 | 0.8583\nTID2013|   0.6590 | 0.8445 | 0.8471\nKADID-10k| 0.6175 | 0.8133 | 0.8030\nKonFiG(F)| 0.7668 | 0.9194 | 0.9136\n\nSSIMULACRA 2.0:\n\nDataset | KRCC | SRCC | PCC |\n-- | -- | -- | --\nCID22|      0.6934 | 0.8820 | 0.8601\nTID2013|    0.6322 | 0.8194 | 0.8103\nKADID-10k|  0.5870 | 0.7851 | 0.7018\nKonFiG(F)|  0.7813 | 0.9280 | 0.8710\n\n\n\nThe weight tuning was done by running Nelder-Mead simplex search, optimizing to minimize MSE and to\nmaximize Kendall and Pearson correlation for training data consisting of the CID22 training data,\nTID2013, KADID-10k and KonFiG (F boosting).\n\nChanges compared to SSIMULACRA 2.0:\n\n- weights retuned to correlate better with other datasets\n- changed the range of the 3 components to ensure they are in 0..1 so the SSIM formula makes sense\n- added a polynomial remapping of the error score to allow a better fit to datasets with higher distortions\n\n\nChanges compared to the [original version (SSIMULACRA 1)](https://github.com/cloudinary/ssimulacra):\n\n- works in XYB color space instead of CIE Lab\n- linear downscaling\n- fixed SSIM formula\n- uses 1-norm and 4-norm (instead of 1-norm and max-norm-after-downscaling)\n- penalizes both smoothing and ringing artifacts (instead of only penalizing ringing but not smoothing)\n- removed specific grid-like blockiness detection\n- tuned using a much larger set of subjective opinions (and using absolute quality scores, not just relative comparison results)\n\n\n\n\n## Metric performance\n\n\nThese tables show the correlation of various metrics in terms of\nKendall Rank Correlation Coefficient (KRCC),\nSpearman Rank Correlation Coefficient (SRCC),\nand Pearson Correlation Coefficient (PCC), for various IQA datasets.\n\nTID2013:\n\nMetric | KRCC | SRCC | PCC |\n-- | -- | -- | --\nPSNR-Y | 0.4699 | 0.6394 | 0.428\nPSNR-HVS | 0.5464 | 0.698 | 0.6846\nSSIM | 0.5707 | 0.7552 | 0.764\nMS-SSIM | 0.6068 | 0.7868 | 0.7802\nVMAF | 0.5608 | 0.7439 | 0.7728\nSSIMULACRA 2 | 0.6322 | 0.8194 | 0.8103\nSSIMULACRA 2.1 | 0.659 | 0.8445 | 0.8471\nDSSIM | -0.6984 | -0.871 | -0.8021\nButteraugli (3-norm) | -0.4935 | -0.6639 | -0.4878\nPSNR (ImageMagick) | 0.4958 | 0.6869 | 0.6601\n\nKADID-10k:\n\nMetric | KRCC | SRCC | PCC |\n-- | -- | -- | --\nPSNR-Y | 0.4555 | 0.6319 | 0.5932\nPSNR-HVS | 0.4229 | 0.5927 | 0.5949\nSSIM | 0.5889 | 0.7806 | 0.6576\nMS-SSIM | 0.6466 | 0.8359 | 0.6836\nVMAF | 0.5343 | 0.7253 | 0.7185\nSSIMULACRA 2 | 0.587 | 0.7851 | 0.7018\nSSIMULACRA 2.1 | 0.6175 | 0.8133 | 0.803\nDSSIM | -0.6679 | -0.8561 | -0.6544\nButteraugli (3-norm) | -0.3846 | -0.543 | -0.4424\nPSNR (ImageMagick) | 0.4876 | 0.6757 | 0.6214\n\n\nKonFiG-IQA: (Experiment I, F boosting, clamping negative JND (better than reference) to zero)\n\nMetric | KRCC | SRCC | PCC |\n-- | -- | -- | --\nPSNR-Y | 0.5871 | 0.7598 | 0.6968 |\nPSNR-HVS | 0.7798 | 0.9277 | 0.8453 |\nSSIM | 0.6156 | 0.7795 | 0.7052 |\nMS-SSIM | 0.6635 | 0.8299 | 0.6834 |\nVMAF | 0.3866 | 0.4906 | 0.463 |\nSSIMULACRA 2 | 0.7813 | 0.928 | 0.871 |\nSSIMULACRA 2.1 | 0.7668 | 0.9194 | 0.9136 |\nDSSIM | -0.7595 | -0.9147 | -0.673 |\nButteraugli (3-norm) | -0.771 | -0.9238 | -0.7587 |\nPSNR (ImageMagick) | 0.6531 | 0.8248 | 0.7218 |\n\n\nCID22 full set: (22k subjective scores)\n\nMetric | KRCC | SRCC | PCC |\n-- | -- | -- | --\nPSNR-Y | 0.4452 | 0.6246 | 0.5901\nPSNR-HVS | 0.6076 | 0.81 | 0.7559\nSSIM | 0.5628 | 0.7577 | 0.7005\nMS-SSIM | 0.5596 | 0.7551 | 0.7035\nVMAF | 0.6176 | 0.8163 | 0.7799\nSSIMULACRA 2 | 0.6934 | 0.882 | 0.8601\nSSIMULACRA 2.1 | 0.6903 | 0.8805 | 0.8583\nDSSIM | -0.6428 | -0.8399 | -0.7813\nButteraugli 3-norm | -0.6547 | -0.8387 | -0.7903\nPSNR (ImageMagick) | 0.3472 | 0.5002 | 0.4817\n\n\nCID22 validation set: (4292 subjective scores, not used for tuning)\n\nMetric | KRCC | SRCC | PCC |\n-- | -- | -- | --\nPSNR-Y | 0.4734 | 0.6577 | 0.6354\nPSNR-HVS | 0.6199 | 0.8224 | 0.7848\nSSIM | 0.6028 | 0.7871 | 0.7647\nMS-SSIM | 0.5915 | 0.7781 | 0.7601\nVMAF | 0.588 | 0.7884 | 0.7502\nSSIMULACRA 2 | 0.7033 | 0.8854 | 0.8745\nSSIMULACRA 2.1 | 0.7077 | 0.8904 | 0.8787\nDSSIM | -0.6807 | -0.8722 | -0.822\nButteraugli 3-norm | -0.6102 | -0.7938 | -0.745\nPSNR (ImageMagick) | 0.3491 | 0.4995 | 0.5013\n\n\n\n## Building\n\nBuilding instructions for Debian:\n```\nsudo apt install build-essential git libhwy-dev liblcms2-dev libjpeg62-turbo-dev libpng-dev cmake ninja-build\nmkdir build\ncd build\ncmake ../src -G Ninja\nninja ssimulacra2\n```\n\nor simply execute `build_ssimulacra2`. Other distributions should be similar;\nyou may need to use `libjpeg-turbo8-dev` instead of `libjpeg62-turbo-dev`.\nVersion 2.13 of lcms2 is needed.\n\nThe source code of SSIMULACRA 2 is also part of the `tools` of [libjxl](https://github.com/libjxl/libjxl/blob/main/tools/ssimulacra2.cc).\n\nThe bash script `build_ssimulacra2_from_libjxl_repo` can be used to fetch the code and compile only what is needed for SSIMULACRA 2.\n\n\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcloudinary%2Fssimulacra2","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fcloudinary%2Fssimulacra2","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcloudinary%2Fssimulacra2/lists"}