Saturday, March 3, 2012

xBR vs HQx Interpolation Filter Comparison

UPDATE: the comparisons in this post aren't a true representation of hq2x (more info in this post). The xBR shots are still valid, but don't put much weight on the comparisons without reading the other post for context.

This post compares the popular HQx interpolation algorithm with the newer xBR, which has been covered in some of my other posts. If you just want to download the filters, you can get them from the link at the bottom of the post.

Since Maxim Stepin created the HQx interpolation algorithm more than a decade ago, it has been the favored real-time interpolation filter for the emulation scene. The way it works is it looks at each pixel and then compares its color to that of the 8 surrounding adjacent pixels. If it finds a match, the filter then compares the resulting pattern with a predefined lookup table to guess what the original pattern was trying to represent.

For example, if we take a pattern like this:


and scale it up via nearest neighbor--that is, a straight upscale with no interpolation--you end up with this checkerboard pattern:

But, if you use HQ2x, you end up with this:

The algorithm guesses that the original pattern was trying to represent a diagonal line rather than a checkerboard pattern, so it fills in the gaps to compensate.

Recently, a Brazilian programmer by the name of Hyllian (aka Jararaca) developed a new algorithm that actually improves on HQx, known as xBR (stands for "a filter that scales By Rules").

xBR works much the same way as HQx insofar as it is based on pattern recognition, and it would upscale the above pattern with the same result. However, it goes further than HQx by using a 2-stage set of interpolation rules, which better handle more complex patterns such as antialiased lines and curves. The two main points that can be fine-tuned are the formula used to measure the distance between colors and the way the algorithm treats corners (more on the corners later).

Hyllian began development of xBR in 2011 as a plugin for Steve Snake's Genesis/Mega Drive emulator, Kega Fusion.

You can read more about Hyllian's algorithm here.

Lets take a look at how they compare on a real-world example (HQ2x on the left, 2xBR on the right; click to embiggen):


As you can see, 2xBR does a much better job on smoothing curves without getting chunky (see Yoshi's nose and the dragon coin). It also does a better job on the 'eyes' of the block, which is represented as a diagonal line with 2xBR compared with the series-of-squares look with HQ2x.

Here's another comparison, using Earthworm Jim's title screen:
 


And here's a third comparison, using the title screen to Earthworm Jim 2:


HQ2x actually does a slightly better job at getting a smooth gradient around the highlight in Jim's eye, but the rest of the image is a mess. xBR has smoother, straighter lines at every color transition.

Additionally, the xBR algorithm scales to higher scale factors much more easily than the HQx algorithm, making 3-, 4-, 5- and higher versions faster and more effective.

At very high scale factors (5 and higher), the xBR algorithm can obliterate some small details, such as pupils in eyes, dots, and so on, so Hyllian introduced some additional calculation to compensate (5xBR-v3.5a on the left [uncompensated] vs 5xBR-v3.5b on the right [compensated]):


Of course, this compensation comes with its own drawbacks and false-positives, so which version works better varies on a game-by-game basis.

UPDATE: Hyllian has made a third variant that is even more cautious. Here's an animated GIF comparing the way each variant handles text:
Another interesting aspect of this algorithm is that it works very effectively on images already upscaled with xBR, so you can easily get absurdly large images (scaled 1x, 3x, 9x and 27x) with just a few iterations:
This puts it in direct and favorable competition with this vectorization method that recently made the rounds. xBR manages to maintain detail a bit better than the vectorizer, and it can actually operate in real-time, unlike the vectorizer.

You can download these shaders from my Mediafire repo (most are available in either XML/GLSL or Cg format, both of which are compatible with SSNES). UPDATE: KrossX ported 2xBR-v3.5a to ePSXe format and SimoneT ported 5xBR-v3.5a.

UPDATE: New Cg version of 5x variant. Runs approx. 25% faster. :)
UPDATE: new XML versions of 5xBR-v3.7. This package includes 3 variants (a, b and c), as well as the A-variant+scanlines.

UPDATE: Hyllian has been working on a new version that analyzes an image frame by frame and dynamically decides whether to apply xBR smoothing or Reverse-Anti-aliasing to produce the best picture. It handles text better than any filter/shader I've encountered, and it also excels at digitized, prerendered images and backgrounds. Here's a shot of it with Final Fantasy VI on GBA:

You can download this shader here.

UPDATE (4/19/2013): Another great update from Hyllian, this time adding 3 levels of analysis. This version runs a bit slower in my experience (unsurprisingly), but it now handles jagged edges that earlier versions simply couldn't detect, due to their 2-level analysis pattern. Compare this shot with the ones at the top of the post:
Notice that inclined bit of ground under the dragon/yoshi coin. This new version will also really help with Mega Man X games, which tended to have a lot of these sorts of gently sloping planes. You can download a Cg shader of this new version here, or a 3x scale Kega Fusion plugin here.

Closely related to xBR are the SABR shader by Joshua Street and Zenju's xBRZ CPU filter. SABR was written by Mr. Street as part of a school project and it differs from xBR in a couple of ways, including using antialiasing on edges. It was forked from Hyllian's 5xBR v3.7c shader. xBRZ is a rewrite of the xBR algorithm in C++, with some changes to the corner detection and color distance measurement. It was forked around xBR v3.5.

There is also a standalone library written in C that incorporates both the xBR algorithm (as it appears in FFmpeg's libavfilter) and Hqx. You can browse this project's source on github.

Tuesday, February 14, 2012

Nutella Chocolate Éclairs with Custard إكلير الكاسترد وشوكولاتة نوتيلا

Nutella Chocolate Éclairs with Custard إكلير الكاسترد وشوكولاتة نوتيلا

Scroll down for English post
  حاول وافشل ولكن لا تفشل في أن تحاول، إذا نجحت من أول محاولة حاول عمل شيء أصعب، وإذا فشلت فحاول مرة واثنين وثلاثة إلى أن تنجح ولا تيأس. هذا ما تعلمته من طبق اليوم، وصفة اليوم هي وصفة مميزة، فهي من الوصفات التي يمكن أن نقول عنها السهل الممتنع، الإكلير هي حلوى فرنسية عبارة عن نوع من المخبوزات يتم عملها بعجينة تسمى عجينة الشو ويتم حشوها بالكستر أو الكريم باتسيير وتغطى بالشوكولاتة. في الحقيقة كل من تذوق الإكلير من يدي والدتي يعجبه كثيراً ولا أحد يتذوقه منها مرة إلا ويطلبه في كل مرة يحب أن يأتي لزيارتنا حتى صديقاتي، وبما أنني أحب الطبخ فكان هذا بمثابة تحدٍ بالنسبة لي فكنت أريد أن أكون مثل أمي وأقوم بعمله على أكمل وجه، ولكن لأكون صريحة معكم لقد فشلت في عمل الإكلير ثلاث مرات، نعم ثلاث مرات وكنت قريبة جداً من اليأس منه، فأكثر شيء يضايقني هو عندما أحاول عمل أي نوع من الأطعمة وأفشل فيه أو عندما لا تكون النتيجة كما توقعت، ولكن عندما عرفت السر أصبح عمل الإكلير هو من أسهل وأسرع أنواع الحلويات بالنسبة لي (على عكس ما يبدو للبعض وأنا كنت منهم).
   اعتادت والدتي عمل هذا النوع من الحلوى بدون استخدام أي أدوات كهربائية لذلك كنت أراه عملاً شاقاً لأنها تقوم بعمل كمية كبيرة وعند إضافة البيض تقوم بتقليبه مع الخليط بالملعقة الخشبية مع كل بيضة، وصدقوني هذه الطريقة تحتاج إلى عضلات قوية جداً (لن تعرفوا ما أقصد إلا إذا جربتم بأنفسكم)، وكان هذا أحد الأشياء التي تخليت عنها في عمل الإكلير ولم أجد فرق في الطعم وهو أنني أستخدم الفود بروسيسور أو الكبة أو العجان بدلاً من الملعقة الخشبية وما يساعدني في ذلك هو أنني أقوم بعمل كمية مناسبة ليست كبيرة من الإكلير على عكس أمي حيث لا تكفي أي آلة كهربائية للمقادير التي تستخدمها نظراً للعدد الذي يحب أن يأكل هذه الحلوى من يديها :). ثاني شيء ساعد على نجاح الوصفة هو اكتشاف سر النجاح في هذه الوصفة وسأضيفه لكم مع الخطوات المصورة والشرح الوافي والمفصل لعمل الإكلير بسهولة دون أي جهد أو فشل إن شاء الله.

نصيحة الوصفة:
1- أهم نصيحة لهذه الوصفة هي كمية البيض المستخدمة، لا تستخدموا الكمية الموجودة في أي وصفة تقرأونها للإكلير بدون تأكد، فحجم البيض يختلف ونوع الدقيق يختلف لذا لابد من إضافة بيضة في المرة الواحدة وبعد الخلط تأكدوا من أن قوام العجين ليس سائل وليس متماسك بشكل زائد، يكون بين هذا وذاك ويلتصق بالأيدي، لذا قوموا بالتأكد من قوام العجين المناسب قبل إضافة المزيد من البيض، هذه الوصفة أحياناً أقوم بعملها بثلاث بيضات وأحياناً أربعة مع نفس المقادير لذا عليكم التأكد.
2- إذا صَعُب عليكم تحديد قوام العجينة المناسب وكانت هذه أول مرة تقوموا بعمل الإكلير يمكن تجربة واحدة فقط بالفرن واختبارها إذا كانت جيدة أم جافة بشكل زائد أو العكس.
3- يمكن استخدام مقدار الماء أو استخدام نصفه حليب (لا أنصح باستخدام المقدار كامل من الحليب).
4- لأن العجين يلتصق بأي شيء يلامسه فالأفضل دهن كيس الحلواني المستخدم للتكشيل بالزيت من الداخل وأيضا دهن الصينية جيداً بالزيت ثم رشها بالدقيق إذا كانت قابلة للالتصاق أما إذا كانت الصينية غير قابلة للالتصاق يمكن الاكتفاء بدهنها بالزيت.
5- يمكن استخدام أي نوع من الشوكولاتة لتغطية الحلوى أنا أفضل النوتيلا كثيراً.

الوصفة تكفــي: 20 قطعة إكلير متوسطة
وقت التحضير: 15 دقيقة


وقت الخبـــــز: 27 إلى 35 دقيقة
   Try and fail, but don't fail to try, If at first you do succeed, try something harder, and if you fail try once, twice and again till you succeed. That's what I've learned from today's dish. Today's recipe is so special, it's one of the recipes that you can call challenging ease, Eclair is a french dessert made from a dough called pâte à choux, filled with custard or Crème pâtissière and covered with melt chocolate. In fact everyone tastes this dessert from my mother's hands likes it so much and no one does without asking her to make eclair every time they visit even my friends, and because I love cooking so much that was like a challenge for me, I wanted to be like my mother, I wanted to make eclairs in a perfect way, but to be honest with you, I failed at making eclair THREE times, yes three times and was so close to giving up, as the most thing that annoys me is to fail at cooking something or get a bad result not as I expected, but when I knew the secret of making eclair it became one of the easiest and quickest desserts for me to make (not like it seems to be for some people and I was one of them).
    My mother used to make this dessert without using any mixers or kitchen machines, so I used to see it as hard work because she use to make large amount and mix the eggs one at a time with a wooden spoon till it's well mixed in the dough, and believe that really needs tough muscles (you wouldn't know what I mean till you try it yourselves), and that was one thing that I gave up when making eclairs as I just use my food processor to mix the eggs in the dough, and what helps me here is that I usually make small amount not like my mother as I don't think there's any stand mixer or food processor can be enough for the amount she makes because there are many people waiting for her to finish so they eat her eclairs :). The second thing that helped me is the secret that I've discover for this dough which I'm going to write it down for you with detailed steps with step-by-step photos for making eclair without any hard work or failure God willing.

Recipe Tips:
1- The most important thing is the amount of eggs you use, never use the any amount that any recipe calls for with blind eyes, you have to make sure as the eggs are different in size and the flour is not the same for everyone, so it's the texture of the dough that tells you to stop adding eggs or to add more, as it suppose to be sticky but not runny, easy to shape with piping bag without melting and without being tough, so it's between this and that, so you add one egg at a time and mix to see, in this same recipe I sometimes use 3 and sometimes 4 eggs, so don't stick to it.
2- If it's hard for you to determine the texture of the dough, you can test one eclair in the oven to see if it's ok or tough which means it needs more egg.
3- You can use half milk half water instead of all water like the recipe here (don't recommend all milk).
4- As I said before the dough is sticky so you need to first grease the piping bag from the inside and also the baking sheet only with oil if it's non stick or with oil and flour if it's an ordinary one.
5- You can use any chocolate you like to cover the dessert, as for me I LOVE Nutella :).

Recipe serves: 20 medium eclairs approx.
Prep. Time: 15 minutes.
Baking Time: 27 to 35 minutes
Click here for the recipe اضغط هنا للوصفة »

Thursday, January 19, 2012

Feta Omelette أومليت بجبن الفيتا

Feta Omelette أومليت بجبن الفيتا

Scroll down for English post
وصفة اليوم خفيفة وسريعة خاصة بالإفطار أو العشاء، سبق وأن قمت بإضافة طريقة أخرى للأومليت بمكونات مختلفة أتمنى أن تجربوها أيضاً، اليوم سوف أقوم بعمل الأومليت مع جبن الفيتا لجميع محبيها.
نصيحة الوصفة:
1- يجب أن يتم طهي الأومليت على حرارة هادئة حتى لا يحترق دون أن ينضج من الوسط.
2- لا نقم بزيادة الملح لوجود ملح بالجبن.
3- يمكن استخدام طبق لقلب الأومليت بوضع الأومليت في الطبق ثم قلبه في المقلاة بحرص.

الوصفة تكفــي: شخص إلى شخصين
وقت التحضير: 2 دقيقة
وقت الطهــــي: 5 دقائق
Today's recipe is light and quick specially for breakfast or dinner, I have already made Omelette with different ingredients before I hope you try it too, today I will make Feta Omelette for all Feta lovers :)

Recipe Tip:
1- You should cook the omelette on low heat so it wont burn without cooking from inside.
2- Don't add much salt to the omelette, you already have salt in the cheese.
3- You can use a plate to flip the omelette by place it in the plate then carefully reverse it to the pan.

Serves: 1 to 2 people
Prep. Time: 2 minutes
Cooking Time: 5 minutes
Click here for the recipe اضغط هنا للوصفة »

Sunday, January 15, 2012

Pasta Frolla (Jam Shortbread or cake) باستا فلورا أو المبروشة

Pasta Frolla (Jam Shortbread or cake) باستا فلورا أو المبروشة

Scroll down for English post
وصفة اليوم حلوى سهلة سريعة ولذيذة جداً، الباستا فلورا (بسطا فلورا أو باسطا فلورا) كما هو اسمها في مصر واليونان وبلدان أخرى هي عبارة عن كيك بالمربى، ومعروفة في بعض البلاد مثل إيطاليا والأرجنتين وبرجواي وأورجواي وبلدان أخرى باسم الباستا فرولا ولكن تكون حشوتها مختلفة عن المربى وفي الغالب يستخدم الدولسي دي ليتشي (نوع من الحلوى المصنعة باستخدام الحليب المركز المحلى). في وصفة اليوم قمت باستخدام مربى الفراولة وهي المربى المفضلة بالنسبة لي، يمكنكم استخدام أي نوع آخر من المربى تفضلونه، كما يمكنكم تنكيه هذا النوع من الكيك بأي نكهة باستخدام المنكهات المختلفة مثل الفانيليا التي قمت باستخدامها اليوم أو يمكن استخدام طعم اللوز أو الليمون أو القرفة بالطبع مع التنسيق مع طعم المربى المفضلة لديكم، كما يمكنكم التحكم في نسبة المربى بزيادتها إذا كنتم تفضلون الحلوى كثيرة السكر أو باستخدام نفس المقدار المستخدم في الوصفة للطعم المعتدل. هذه الوصفة في منتهى السهولة لا تأخذ الكثير من الوقت لذا يمكنكم تحضيرها قبل حضور الضيوف بدقائق وتقديمها مع الشاي أو مع المشروب المفضل. أحب هذا النوع من الحلوى كثيراً وأتمنى أن يعجبكم :)
نصيحة الوصفة:
1- يجب الانتباه أثناء وجود الكيك بالفرن لأنه يمكن أن يحترق سريعاً، يتم إخراجه بمجرد الحصول على لون ذهبي واختبار النضج باستخدام العود الخشبي أو السكين.
2- يمكنكم تغطية العجين المغطى بالمربى بأي شكل، أنا أحب الشرائط، لكن يمكنكم تقطيعها أشكال صغيرة أخرى للأطفال.
3- إذا حصلتم على اللون المطلوب دون أن تنضج الكيكة يمكنكم تغطيتها بورق فويل بحيث يكون الجزء المطفي ناحية الكيك حتى تنضج دون أن يحترق وجهها.

الوصفة تكفــي: 4 إلى 6 أشخاص
وقت التحضير: 10 دقائق
وقت الخَبـــــز: 20 دقيقة
Today's recipe is a super yummy and easy quick dessert. Pasta Flora as known in Egypt and Greece and some other countries, is a type of cake or tart with jam, also known as Pastfrola or Pasta Frolla (shortbread) in Italy, Argentina, Paraguay, and Uruguay but in these couturiers it's regularly made with Dulce de Leche (type of creamy dessert made from condensed milk). in today's recipe I used strawberry jam as I love it so much, you can use any type of jam you prefer, as you can use any flavor in this cake like vanilla as I used or Almond flavor, lemon, cinnamon, of course it depends on the jam you're going to use, you can also use the amount of jam you want so if you would like the taste to be so sweet you can use more jam and if not so you can use as much as I used here. This recipe is so easy to make only take minutes to be ready so you can prepare it before any guests arrive and serve it with tea or your favorite drink. I Love this dessert so much and I hope you all like it too :)

Recipe Tip:
1- Be careful to the cake in the oven because it can burn really quickly so watch it from time to time specially after the first 10 minutes and once it gains a nice golden color test it with a toothpick for doneness and take it out of the oven when done.
2- You can shape the top layer of the dough the way you like, I like the strips but you can cut it as small shapes for kids.
3- If you found out the tart gains a good color but not yet cooked from the inside you can cover it with a foil piece (the matt side).

Serves: 4 to 6 people
Prep Time: 10 minutes
Baking Time: 20 minutes
Click here for the recipe اضغط هنا للوصفة »

Friday, January 13, 2012

Hamam Mahshy: Egyptian Stuffed Pigeons طريقة الحمام المحشو بالفريك

Egyptian Stuffed Pigeons "Hamam Mahshy" الحمام المحشو بالفريك

Scroll down for English post
أهلاً بكم في العام الجديد أتمنى أن يكون عام سعيد على الجميع إن شاء الله، وصفة اليوم طبق شهير جداً بمصر لا يمكن أن تزور هذه البلد بدون أن تتذوقه، طبق اليوم هو الحمام المحشي بالفريك، وهو من الأطباق اللذيذة جداً وسهلة التحضير رغم ما يقال عنه أنه صعب ولكنه ليس كذلك هو فقط يحتاج إلى تجربة واحدة وسوف تقومون بعمله وقتما تريدون. هذا الطبق يتم تحضيره في العزائم والمناسبات وأيضاً في الأعياد وفي رمضان، طبق شهي يحبه الجميع لم أعرف أحد تذوقه ولم يحبه، يمكن اعتباره طبق رئيسي بتقديمه مع الفريك أو يمكن اعتباره طبق جانبي بتقديم الحمام بجانب المشويات المختلفة أو بجانب طبق المحشي أو الدولمة. هذا الطبق له نوعان حمام محشو بالفريك أو الفريكة (وهو عبارة عن قمح أخضر يتم تدخينه بطريقة ما لنحصل على طعم مميز مختلف تماماً عن القمح العادي) والنوع الآخر من الحمام محشو بالأرز. قمت بعمل الوصفة بحشوة الفريك الذي أحبه كثيراً، ويمكن استخدام نفس الوصفة باستخدام الأرز لمحبي حشوة الأرز أو إذا لم يتوفر الفريك. 

نصيحة الوصفة:
1-عند شراء الحمام يجب الانتباه إلى أن يكون صغير السن فالحمام الكبير يأخذ وقت كبير جداً للنضج ولا يكون طعم اللحم بمثل لذة الحمام الصغير.
2- انتبهوا جيداً عند سلق الحمام ولا تقوموا بسلقه بشكل زائد عن الحد حتى لا يتقطع الجلد وتخرج الحشوة.
3- يمكن تحمير الحمام بوضعه في الفرن بدل استخدام كمية كبيرة من الزبد لمفضلي الدهون الأقل.
4- يمكن إضافة بعض اللحم المفروم أو المكسرات أو كبد الدجاج للحشوة حسب الرغبة.
5- في حالة عدم توفر الفريك يمكن استخدام البرغل كبديل له، أو يمكن استخدام الأرز وفي هذه الحالة نضيف 3 ملاعق طعام زيت للأرز عند طهيه حتى لا يلتصق ببعضه أثناء طهيه داخل الحمام هنا تجدوا طريقة الحمام المحشو بالأرز.
6- لا تقوموا بحشو الحمام بالضغط والإكثار من الحشوة حتى ينضج جيداً ويدخل المرق بداخله. يجب أن تكون الحشوة متوازنة وغير زائدة عن الحد وأيضاً لا يتم الحشو تحت الجلد بشكل مبالغ فيه حتى لا يتقطع الجلد أثناء الطهي.
7- يجب أن تكون الحرارة هادئة عند تحمير الحمام حتى لا تحترق الزبد وإلا الأفضل أن نستخدم السمن البلدي.

الوصفة تكفــي: 4 أشخاص
وقت التحضير: 15 دقيقة 
وقت الطهــــي: 40 دقيقة
Welcome to the first post in 2012, I wish you all a happy new year, today's recipe is a delicious popular Egyptian dish, you can't visit Egypt without tasting this yummy dish. Stuffed pigeons or as it's called in Egypt "Hamam Mahsy" is one of the most delicious dishes, it's so easy to make even if it has a different reputation but believe me you just try it once and you will find it very easy to make and you could then make it anytime you want. This dish is served in occasions, feasts, Ramadan Iftar, and also when having family and friends over for lunch, I don't know anyone one tasted that dish and didn't really love it, it can be considered as main dish by serving it with the stuffing or as side dish by serving it with some grilled meat or chicken or with stuffed cabbage or grape leaves "Mahshy". This dish has two different stuffing, one with "Fereek", "Fireek" or "Freekeh" (which is smoked green wheat that has a special taste, so different from regular wheat), and the other stuffing with rice. My stuffing today is with "Fereek" which I really love, and you can make the same recipe using rice for those who love rice more, or if you don't have "Fereek" available.

Recipe tips:
1- When buying pigeons make sure they are young because the older pigeons takes really long time to cook and the meat doesn't have the same delicious taste.
2- Becareful when you cook the pigeons don't over boil them or the skin will tear apart and the stuffing will come out.
3- You can use the oven to give the pigeons a nice color instead of using butter to fry (for those who don't like much fat).
4- You can add some ground meat, nut, or chicken liver to the stuffing, it's up to you.
5- If you don't have "Fereek" available you can use bulgur instead, or you can use rice in this case add some oil about 3 tbsp to the rice to not get sticky.
6- Don't over stuf the pigeons with forcing stuffing inside and pushing or else it will not cook well and won't allow the broth to enter inside the pigeons to cook, also don't over stuf under the skin or it will tear apart.
7- When frying in butter the heat should be low or the butter will burn, if you want it highier you can use Ghee or clarified butter.

Sereves: 4 people
Prep. Time: 15 minutes.
Cooking Time: 40 minutes
Click here for the recipe اضغط هنا للوصفة »

Saturday, January 7, 2012

Apple iPod Nano 1G Recall

Due to a potential for exploding batteries, Apple recently instituted a recall on all 1G iPod Nanos, of which I had two (one with 2GB capacity and one with 4GB). I sent them off and, after a pretty long turnaround time (nearly two months altogether), I've received my first replacement: a brand new 6th generation touchscreen iPod Nano with 8GB capacity :D

If you happen to have one or more of the old models, I recommend you take advantage.

Cari Farmasi

Farmasi Di Kuala Lumpur dan Selangor Selangor / KL Area NO SHOPS NAMES ...