| 1 | /* |
| 2 | * |
| 3 | * BaltanTV - like StreakTV, but following for a long time |
| 4 | * Copyright (C) 2001 FUKUCHI Kentarou |
| 5 | * ported to FreeJ by jaromil |
| 6 | * |
| 7 | * 2009/8/26 |
| 8 | * Ported to frei0r from the old FreeJ filter API |
| 9 | * -Jaromil |
| 10 | * |
| 11 | * This source code is free software; you can redistribute it and/or |
| 12 | * modify it under the terms of the GNU Public License as published by |
| 13 | * the Free Software Foundation; either version 3 of the License, or |
| 14 | * (at your option) any later version. |
| 15 | * |
| 16 | * This source code is distributed in the hope that it will be useful, |
| 17 | * but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 18 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. Please refer |
| 19 | * to the GNU Public License for more details. |
| 20 | * |
| 21 | * You should have received a copy of the GNU Public License along |
| 22 | * with this source code; if not, write to: Free Software Foundation, |
| 23 | * Inc., 675 Mass Ave, Cambridge, MA 02139, USA. |
| 24 | */ |
| 25 | |
| 26 | #include <stdlib.h> |
| 27 | #include <string.h> |
| 28 | |
| 29 | #include <frei0r.hpp>cxx . . $ `<file>/include/frei0r.hpp`/ |
| 30 | |
| 31 | #define PLANEScxx . . $ `src/filter/baltan/baltan.cpp:31:9`! 32 |
| 32 | |
| 33 | #define STRIDEcxx . . $ `src/filter/baltan/baltan.cpp:33:9`! 8 |
| 34 | #define STRIDE2cxx . . $ `src/filter/baltan/baltan.cpp:34:9`! 16 /* (STRIDE*2) */ |
| 35 | #define STRIDE3cxx . . $ `src/filter/baltan/baltan.cpp:35:9`! 24 /* (STRIDE*3) */ |
| 36 | |
| 37 | // freej compat facilitator |
| 38 | typedef structcxx . . $ $anonymous_type_8adadfcec488cc5_0# { |
| 39 | int16_t wcxx . . $ $anonymous_type_8adadfcec488cc5_0#w.; |
| 40 | int16_t hcxx . . $ $anonymous_type_8adadfcec488cc5_0#h.; |
| 41 | uint8_t bppcxx . . $ $anonymous_type_8adadfcec488cc5_0#bpp.; |
| 42 | uint32_t sizecxx . . $ $anonymous_type_8adadfcec488cc5_0#size.; |
| 43 | } ScreenGeometrycxx . . $ ScreenGeometry#; |
| 44 | |
| 45 | |
| 46 | class Baltancxx . . $ Baltan#: public frei0rcxx . . $ frei0r/::filtercxx . . $ frei0r/filter# { |
| 47 | |
| 48 | public: |
| 49 | Baltancxx . . $ Baltan#Baltan(3e454b8ccf442868).(int wdt, int hgt); |
| 50 | ~cxx . . $ Baltan#`~Baltan`(49f6e7a06ebc5aa8).Baltancxx . . $ Baltan#(); |
| 51 | |
| 52 | virtual void updatecxx . . $ Baltan#update(da7b4a17ceb4e697).(double time, |
| 53 | uint32_t* out, |
| 54 | const uint32_t* in); |
| 55 | |
| 56 | private: |
| 57 | ScreenGeometrycxx . . $ ScreenGeometry# geocxx . . $ Baltan#geo.; |
| 58 | |
| 59 | void _initcxx . . $ Baltan#_init(3e454b8ccf442868).(int wdt, int hgt); |
| 60 | |
| 61 | uint32_t *planebufcxx . . $ Baltan#planebuf.; |
| 62 | uint32_t *planetablecxx . . $ Baltan#planetable.[PLANEScxx . . $ `src/filter/baltan/baltan.cpp:31:9`!]; |
| 63 | int planecxx . . $ Baltan#plane.; |
| 64 | int pixelscxx . . $ Baltan#pixels.; |
| 65 | }; |
| 66 | |
| 67 | Baltancxx . . $ Baltan#::Baltancxx . . $ Baltan#Baltan(3e454b8ccf442868).(int wdt, int hgt) { |
| 68 | int i; |
| 69 | |
| 70 | _initcxx . . $ Baltan#_init(3e454b8ccf442868).(wdt, hgt); |
| 71 | pixelscxx . . $ Baltan#pixels. = geocxx . . $ Baltan#geo..wcxx . . $ $anonymous_type_8adadfcec488cc5_0#w.*geocxx . . $ Baltan#geo..hcxx . . $ $anonymous_type_8adadfcec488cc5_0#h.; |
| 72 | |
| 73 | planebufcxx . . $ Baltan#planebuf. = (uint32_t*)calloccxx . . $ calloc(63a7bf2941bfcd7a).(geocxx . . $ Baltan#geo..sizecxx . . $ $anonymous_type_8adadfcec488cc5_0#size., PLANEScxx . . $ `src/filter/baltan/baltan.cpp:31:9`!); |
| 74 | |
| 75 | for(i=0;i<PLANEScxx . . $ `src/filter/baltan/baltan.cpp:31:9`!;i++) |
| 76 | planetablecxx . . $ Baltan#planetable.[i] = &planebufcxx . . $ Baltan#planebuf.[pixelscxx . . $ Baltan#pixels.*i]; |
| 77 | |
| 78 | planecxx . . $ Baltan#plane. = 0; |
| 79 | } |
| 80 | |
| 81 | Baltancxx . . $ Baltan#::~cxx . . $ Baltan#`~Baltan`(49f6e7a06ebc5aa8).Baltancxx . . $ Baltan#() { |
| 82 | freecxx . . $ free(5d22bdacc48458e8).(planebufcxx . . $ Baltan#planebuf.); |
| 83 | } |
| 84 | |
| 85 | void Baltancxx . . $ Baltan#::updatecxx . . $ Baltan#update(da7b4a17ceb4e697).(double time, |
| 86 | uint32_t* out, |
| 87 | const uint32_t* in) { |
| 88 | int i, cf; |
| 89 | |
| 90 | uint32_t *src = (uint32_t*)in; |
| 91 | uint32_t *dst = (uint32_t*)out; |
| 92 | |
| 93 | |
| 94 | for(i=0; i<pixelscxx . . $ Baltan#pixels.; i++) |
| 95 | planetablecxx . . $ Baltan#planetable.[planecxx . . $ Baltan#plane.][i] = (src[i] & 0xfcfcfc)>>2; |
| 96 | |
| 97 | |
| 98 | cf = planecxx . . $ Baltan#plane. & (STRIDEcxx . . $ `src/filter/baltan/baltan.cpp:33:9`!-1); |
| 99 | |
| 100 | for(i=0; i<pixelscxx . . $ Baltan#pixels.; i++) { |
| 101 | dst[i] = (src[i]&0xFF000000) |
| 102 | |(planetablecxx . . $ Baltan#planetable.[cf][i] |
| 103 | + planetablecxx . . $ Baltan#planetable.[cf+STRIDEcxx . . $ `src/filter/baltan/baltan.cpp:33:9`!][i] |
| 104 | + planetablecxx . . $ Baltan#planetable.[cf+STRIDE2cxx . . $ `src/filter/baltan/baltan.cpp:34:9`!][i] |
| 105 | + planetablecxx . . $ Baltan#planetable.[cf+STRIDE3cxx . . $ `src/filter/baltan/baltan.cpp:35:9`!][i]); |
| 106 | planetablecxx . . $ Baltan#planetable.[planecxx . . $ Baltan#plane.][i] = (dst[i]&0xfcfcfc)>>2; |
| 107 | } |
| 108 | |
| 109 | |
| 110 | planecxx . . $ Baltan#plane.++; |
| 111 | planecxx . . $ Baltan#plane. = planecxx . . $ Baltan#plane. & (PLANEScxx . . $ `src/filter/baltan/baltan.cpp:31:9`!-1); |
| 112 | |
| 113 | } |
| 114 | |
| 115 | void Baltancxx . . $ Baltan#::_initcxx . . $ Baltan#_init(3e454b8ccf442868).(int wdt, int hgt) { |
| 116 | geocxx . . $ Baltan#geo..wcxx . . $ $anonymous_type_8adadfcec488cc5_0#w. = wdt; |
| 117 | geocxx . . $ Baltan#geo..hcxx . . $ $anonymous_type_8adadfcec488cc5_0#h. = hgt; |
| 118 | geocxx . . $ Baltan#geo..bppcxx . . $ $anonymous_type_8adadfcec488cc5_0#bpp. = 32; |
| 119 | geocxx . . $ Baltan#geo..sizecxx . . $ $anonymous_type_8adadfcec488cc5_0#size. = geocxx . . $ Baltan#geo..wcxx . . $ $anonymous_type_8adadfcec488cc5_0#w.*geocxx . . $ Baltan#geo..hcxx . . $ $anonymous_type_8adadfcec488cc5_0#h.*(geocxx . . $ Baltan#geo..bppcxx . . $ $anonymous_type_8adadfcec488cc5_0#bpp./8); |
| 120 | } |
| 121 | |
| 122 | frei0rcxx . . $ frei0r/::constructcxx . . $ frei0r/construct#<Baltancxx . . $ Baltan#> plugincxx . . $ plugin.("Baltan"cxx . . $ std/__cxx11/basic_string#basic_string(e36662616dba894d)., |
| 123 | "delayed alpha smoothed blit of time"cxx . . $ std/__cxx11/basic_string#basic_string(e36662616dba894d)., |
| 124 | "Kentaro, Jaromil"cxx . . $ std/__cxx11/basic_string#basic_string(e36662616dba894d)., |
| 125 | 3,1); |