{"id":58,"date":"2009-06-11T18:37:40","date_gmt":"2009-06-11T18:37:40","guid":{"rendered":"https:\/\/blogs.scummvm.org\/upthorn\/?p=58"},"modified":"2022-05-25T18:39:08","modified_gmt":"2022-05-25T18:39:08","slug":"bitdepth-pixelformat-pros-and-cons","status":"publish","type":"post","link":"https:\/\/blogs.scummvm.org\/upthorn\/2009\/06\/11\/bitdepth-pixelformat-pros-and-cons\/","title":{"rendered":"bitdepth\/pixelformat pros and cons"},"content":{"rendered":"<div class=\"meta\"><\/div>\n<div class=\"storycontent\">\n<p>I have recieved and reviewed the discussion in the bitdepth\/pixelformat mailing list thread that I started, and I\u2019m a bit worried by the results:<\/p>\n<ul>\n<li>One vote (Sven) for the old bitformat (8, 555, 565, 888) style of format specification<\/li>\n<li>One vote (Eugene) for the engine requesting only a bitdepth, not a full format<\/li>\n<li>Two votes (Johannes and Max) for the engine requesting a (list of) fully formed Graphics::PixelFormat object(s).<\/li>\n<li>One vote (Myself) for using an enumerated list<\/li>\n<li>Three people (Marcus, Joost, Oystein) contributing useful information about backend concerns, but no recommendations of their own<\/li>\n<\/ul>\n<p>Nothing resembling a consensus, and very little discussion on the pros and cons of each method.<\/p>\n<p>So, I\u2019m going to list the pros and cons (as I see them) for each format:<\/p>\n<ul>\n<li>Old bitformat:\n<ul>\n<li>Pros:\n<ul>\n<li>Already defined and implemented<\/li>\n<\/ul>\n<ul>\n<li>Values presented in a very readable and understandable format<\/li>\n<\/ul>\n<ul>\n<li>Requires minimum of sanity checking by backends<\/li>\n<\/ul>\n<ul>\n<li>Requires minimum of sanity checking by engines<\/li>\n<\/ul>\n<\/li>\n<\/ul>\n<ul>\n<li>Cons:\n<ul>\n<li>Requires extra work for backends wanting to add support for a format not currently defined<\/li>\n<li>Requires extra conversions to\/from a format that can be understood by video interface<\/li>\n<li>Viewed as outdated and \u201cevil\u201d by some menbers of the community<\/li>\n<\/ul>\n<\/li>\n<li>Neutral\/dependant:\n<ul>\n<li>Backend responsible for specifying color order<\/li>\n<\/ul>\n<\/li>\n<\/ul>\n<\/li>\n<li>Bitdepth only\n<ul>\n<li>Pros:\n<ul>\n<li>Already defined<\/li>\n<li>Values presented in a very readable and understandable format<\/li>\n<li>Minimum of sanity checking necessary for backend<\/li>\n<\/ul>\n<\/li>\n<li>Cons\n<ul>\n<li>Disallows possibility of multiple formats in same bitdepth (ARGB1555\/RGB555\/RGB565\/RGBA444)<\/li>\n<li>Requires all engines with higher than 256 color modes to fully understand Graphics::PixelFormat values<\/li>\n<li>Requires all engines with higher than 256 color modes to support color format conversions to match backend<\/li>\n<li>Requires extra conversions to\/from a format that can be understood by video interface<\/li>\n<\/ul>\n<\/li>\n<li>Neutral\/dependant:\n<ul>\n<li>Backend entirely responsible for specifying color format<\/li>\n<\/ul>\n<\/li>\n<\/ul>\n<\/li>\n<li>Graphics::PixelFormat\n<ul>\n<li>Pros:\n<ul>\n<li>Already defined and implemented<\/li>\n<li>Allows great flexibility in negotiation of color mode between engine and backend<\/li>\n<li>No extra conversions necessary once format is agreed upon<\/li>\n<\/ul>\n<\/li>\n<li>Cons:\n<ul>\n<li>Complicated for engine to produce a list of supported formats<\/li>\n<li>Requires backend developers to create and maintain a comprehensive list of supported formats or perform extensive checks to determine compatibility.<\/li>\n<li>Requires engine to fully understand and work with Graphics::PixelFormat object<\/li>\n<\/ul>\n<\/li>\n<li>Neutral\/dependant:\n<ul>\n<li>Engine is primarily responsible for determining color format.<\/li>\n<\/ul>\n<\/li>\n<\/ul>\n<\/li>\n<li>Enum type (colormode and colororder fields)\n<ul>\n<li>Pros:\n<ul>\n<li>Allows great flexibility in negotiation of color mode between engine and backend<\/li>\n<li>Values presented in a very readable and understandable format<\/li>\n<li>Requires minimum of sanity checking by backends<\/li>\n<li>Requires minimum of sanity checking by engines<\/li>\n<\/ul>\n<\/li>\n<li>Cons:\n<ul>\n<li>Slightly complicated for engine to produce list of supported formats.<\/li>\n<li>Requires extra conversions to\/from a format that can be understood by video interface.<\/li>\n<\/ul>\n<\/li>\n<li>Neutral\/dependant:\n<ul>\n<li>Engine is primarily responsible for determining color format.<\/li>\n<\/ul>\n<\/li>\n<\/ul>\n<\/li>\n<li>Enum type (colormode only)\n<ul>\n<li>Pros:\n<ul>\n<li>Values presented in a very readable and understandable format<\/li>\n<li>Requires minimum of sanity checking by backends<\/li>\n<li>Requires minimum of sanity checking by engines<\/li>\n<\/ul>\n<\/li>\n<li>Cons:\n<ul>\n<li>Requires extra conversions to\/from a format that can be understood by video interface.<\/li>\n<\/ul>\n<\/li>\n<li>Neutral\/dependant:\n<ul>\n<li>Backend responsible for specifying color order<\/li>\n<\/ul>\n<\/li>\n<\/ul>\n<\/li>\n<li>New type (not yet defined)\n<ul>\n<li>Pros:\n<ul>\n<li>Can be designed specifically for this task<\/li>\n<\/ul>\n<\/li>\n<li>Cons:\n<ul>\n<li>May require significant effort to implement<\/li>\n<\/ul>\n<\/li>\n<\/ul>\n<\/li>\n<\/ul>\n<p>Now, if I take Eugene\u2019s recommendation (from IRC) that color order passed from engine to backend is always RGBA, then removing the ability from the engines to specify their own order is actually a plus, as it shields from potential future developer error. But, I don\u2019t know if that idea is universally agreed upon.<\/p>\n<\/div>\n","protected":false},"excerpt":{"rendered":"<p>I have recieved and reviewed the discussion in the bitdepth\/pixelformat mailing list thread that I started, and I\u2019m a bit worried by the results: One vote (Sven) for the old bitformat (8, 555, 565, 888) style of format specification One vote (Eugene) for the engine requesting only a bitdepth, not a full format Two votes [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[1],"tags":[],"class_list":["post-58","post","type-post","status-publish","format-standard","hentry","category-uncategorized"],"_links":{"self":[{"href":"https:\/\/blogs.scummvm.org\/upthorn\/wp-json\/wp\/v2\/posts\/58","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/blogs.scummvm.org\/upthorn\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/blogs.scummvm.org\/upthorn\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/blogs.scummvm.org\/upthorn\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/blogs.scummvm.org\/upthorn\/wp-json\/wp\/v2\/comments?post=58"}],"version-history":[{"count":3,"href":"https:\/\/blogs.scummvm.org\/upthorn\/wp-json\/wp\/v2\/posts\/58\/revisions"}],"predecessor-version":[{"id":61,"href":"https:\/\/blogs.scummvm.org\/upthorn\/wp-json\/wp\/v2\/posts\/58\/revisions\/61"}],"wp:attachment":[{"href":"https:\/\/blogs.scummvm.org\/upthorn\/wp-json\/wp\/v2\/media?parent=58"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/blogs.scummvm.org\/upthorn\/wp-json\/wp\/v2\/categories?post=58"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/blogs.scummvm.org\/upthorn\/wp-json\/wp\/v2\/tags?post=58"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}