Thank you to anyone who has already donated - your generous donations helped make three months of treatment possible.
My brother Nate continues to fight stage IV Hodgkin's lymphoma. He's just 31, with a wife and baby girl. They have no active income (since he's been unable to return to work), no insurance, and cannot afford the treatment he needs. Nate and his family need your help. Please consider a donation, every dollar helps. Thanks.
1 2 3 4 5 6 7 8 9 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 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 |
#define DEBUGF(...) #endif -#ifndef PLUGIN -#define API(x) x -#else -#define API(x) rb->x - -static const struct plugin_api *rb; - -void resize_init(const struct plugin_api *api) -{ - rb = api; -} -#endif - /* calculate the maximum dimensions which will preserve the aspect ration of src while fitting in the constraints passed in dst, and store result in dst, returning 0 if rounding and 1 if not rounding. oxe = 0; mul = 0; /* give other tasks a chance to run */ - API(yield)(); + yield(); for (ix = 0; ix < (unsigned int)ctx->src->width; ix++) { oxe += ctx->bm->width; #ifdef HAVE_LCD_COLOR uint32_t *rowacc = (uint32_t *) ctx->buf, *rowtmp = rowacc + 3 * ctx->bm->width; - API(memset)((void *)ctx->buf, 0, ctx->bm->width * 2 * sizeof(struct uint32_rgb)); + memset((void *)ctx->buf, 0, ctx->bm->width * 2 * sizeof(struct uint32_rgb)); #else uint32_t *rowacc = (uint32_t *) ctx->buf, *rowtmp = rowacc + ctx->bm->width; - API(memset)((void *)ctx->buf, 0, ctx->bm->width * 2 * sizeof(uint32_t)); + memset((void *)ctx->buf, 0, ctx->bm->width * 2 * sizeof(uint32_t)); #endif SDEBUGF("scale_v_area\n"); /* zero the accumulator and temp rows */ ctx->output_row(oy, (void*)rowacc, ctx); /* clear accumulator row, store partial coverage for next row */ #ifdef HAVE_LCD_COLOR - API(memset)((void *)rowacc, 0, ctx->bm->width * sizeof(uint32_t) * 3); + memset((void *)rowacc, 0, ctx->bm->width * sizeof(uint32_t) * 3); #else - API(memset)((void *)rowacc, 0, ctx->bm->width * sizeof(uint32_t)); + memset((void *)rowacc, 0, ctx->bm->width * sizeof(uint32_t)); #endif mul = oye; oy += rset->rowstep; /* The error is set so that values are initialized on the first pass. */ ixe = ctx->bm->width - 1; /* give other tasks a chance to run */ - API(yield)(); + yield(); for (ox = 0; ox < (uint32_t)ctx->bm->width; ox++) { #ifdef HAVE_LCD_COLOR 0 : needed]; #endif #if CONFIG_CODEC == SWCODEC - len = (unsigned int)API(align_buffer)(PUN_PTR(void**, &buf), len, + len = (unsigned int)align_buffer(PUN_PTR(void**, &buf), len, sizeof(uint32_t)); #endif if (needed > len) struct scaler_context ctx; #ifdef HAVE_ADJUSTABLE_CPU_FREQ - API(cpu_boost)(true); + cpu_boost(true); #endif ctx.store_part = store_part; ctx.args = args; ret = scale_v_linear(rset, &ctx); #endif #ifdef HAVE_ADJUSTABLE_CPU_FREQ - API(cpu_boost)(false); + cpu_boost(false); #endif if (!ret) return 0; struct img_part* (*store_part)(void *args), void *args); -#ifdef PLUGIN -struct plugin_api; -void resize_init(const struct plugin_api *api); -#endif - #endif /* _RESIZE_H_ */ #pragma pack (push, 2) #endif -#ifndef PLUGIN -#define API(x) x -#else -#define API(x) rb->x - -static const struct plugin_api *rb; - -void bmp_init(const struct plugin_api * api) -{ - rb = api; -} -#endif - /* BMP header structure */ struct bmp_header { uint16_t type; /* signature - 'BM' */ }, }; -#if (LCD_DEPTH > 1) || defined(HAVE_REMOTE_LCD) && (LCD_REMOTE_DEPTH > 1) || \ - defined(PLUGIN) +#if (LCD_DEPTH > 1) || defined(HAVE_REMOTE_LCD) && (LCD_REMOTE_DEPTH > 1) /* the full 16x16 Bayer dither matrix may be calculated quickly with this table */ const unsigned char dither_table[16] = { 0,192, 48,240, 12,204, 60,252, 3,195, 51,243, 15,207, 63,255 }; #endif -#ifndef PLUGIN #if ((LCD_DEPTH == 2) && (LCD_PIXELFORMAT == VERTICAL_INTERLEAVED)) \ || (defined(HAVE_REMOTE_LCD) && (LCD_REMOTE_DEPTH == 2) \ && (LCD_REMOTE_PIXELFORMAT == VERTICAL_INTERLEAVED)) 0x0101, 0x0100, 0x0001, 0x0000 }; #endif -#endif /****************************************************************************** * read_bmp_file() const struct custom_format *cformat) { int fd, ret; - fd = API(open)(filename, O_RDONLY); + fd = open(filename, O_RDONLY); /* Exit if file opening failed */ if (fd < 0) { filename, !!(format & FORMAT_REMOTE), !!(format & FORMAT_RESIZE), !!(format & FORMAT_KEEP_ASPECT)); ret = read_bmp_fd(fd, bm, maxsize, format, cformat); - API(close)(fd); + close(fd); return ret; } #endif ibuf = ((unsigned char *)buf) + (BM_MAX_WIDTH << 2) - len; BDEBUGF("read_part_line: cols=%d len=%d\n",cols,len); - ret = API(read)(fd, ibuf, len); + ret = read(fd, ibuf, len); if (ret != len) { DEBUGF("read_part_line: error reading image, read returned %d " if (pad > 0) { BDEBUGF("seeking %d bytes to next line\n",pad); - API(lseek)(fd, pad, SEEK_CUR); + lseek(fd, pad, SEEK_CUR); } #if LCD_DEPTH > 1 || (defined(HAVE_REMOTE_LCD) && LCD_REMOTE_DEPTH > 1) || \ defined(PLUGIN) #endif /*(LCD_DEPTH > 1) || defined(HAVE_REMOTE_LCD) && (LCD_REMOTE_DEPTH > 1)*/ /* read fileheader */ - ret = API(read)(fd, &bmph, sizeof(struct bmp_header)); + ret = read(fd, &bmph, sizeof(struct bmp_header)); if (ret < 0) { return ret * 10 - 2; } int i; union rgb_union pal; for (i = 0; i < numcolors; i++) { - if (API(read)(fd, &pal, sizeof(pal)) != (int)sizeof(pal)) + if (read(fd, &pal, sizeof(pal)) != (int)sizeof(pal)) { DEBUGF("read_bmp_fd: Can't read color palette\n"); return -7; } /* Search to the beginning of the image data */ - API(lseek)(fd, (off_t)letoh32(bmph.off_bits), SEEK_SET); + lseek(fd, (off_t)letoh32(bmph.off_bits), SEEK_SET); - API(memset)(bitmap, 0, totalsize); + memset(bitmap, 0, totalsize); struct bmp_args ba = { .fd = fd, .padded_width = padded_width, .read_width = read_width, short rowstop; }; -#if (LCD_DEPTH > 1) || defined(HAVE_REMOTE_LCD) && (LCD_REMOTE_DEPTH > 1) || \ - defined(PLUGIN) +#if (LCD_DEPTH > 1) || defined(HAVE_REMOTE_LCD) && (LCD_REMOTE_DEPTH > 1) extern const unsigned char dither_table[16]; #define DITHERY(y) (dither_table[(y) & 15] & 0xAA) #define DITHERX(x) (dither_table[(x) & 15]) int maxsize, int format, const struct custom_format *cformat); -#ifdef PLUGIN -struct plugin_api; -void bmp_init(const struct plugin_api * api); -#endif #endif #include "plugin.h" #include "lib/grey.h" +#include "lib/resize.h" +#include "lib/bmp.h" #if LCD_DEPTH == 1 #define BMP_LOAD read_bmp_file * \/ \/ \/ \/ \/ * $Id$ * -* This is a wrapper for the core bmp.c +* Copyright (C) 2009 by Andrew Mahone * +* This is a wrapper for the core resize.c +* * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU General Public License * as published by the Free Software Foundation; either version 2 ****************************************************************************/ #include <plugin.h> +#include "wrappers.h" + +static const struct plugin_api *rb; + #include "../../recorder/resize.c" +void resize_init(const struct plugin_api *api) +{ + rb = api; +} Property changes on: apps/plugins/lib/resize.c ___________________________________________________________________ Added: svn:mergeinfo +/*************************************************************************** +* __________ __ ___. +* Open \______ \ ____ ____ | | _\_ |__ _______ ___ +* Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ / +* Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < < +* Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \ +* \/ \/ \/ \/ \/ +* $Id$ +* +* Copyright (C) 2009 by Andrew Mahone +* +* This is a header for the pluginlib extensions to the core resize.c file +* +* This program is free software; you can redistribute it and/or +* modify it under the terms of the GNU General Public License +* as published by the Free Software Foundation; either version 2 +* of the License, or (at your option) any later version. +* +* This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY +* KIND, either express or implied. +* +****************************************************************************/ + +#ifndef _LIB_RESIZE_H_ +#define _LIB_RESIZE_H_ + +#if LCD_DEPTH == 1 +void resize_init(const struct plugin_api *api); +#endif + +#endif +/*************************************************************************** +* __________ __ ___. +* Open \______ \ ____ ____ | | _\_ |__ _______ ___ +* Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ / +* Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < < +* Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \ +* \/ \/ \/ \/ \/ +* $Id$ +* +* Copyright (C) 2009 by Andrew Mahone +* +* This header redefines some core functions as calls via the plugin_api, to +* allow easy compilation of core source files in the pluginlib with different +* features from the version built for the core, or when a core object file is +* not built for a particular target. +* +* This program is free software; you can redistribute it and/or +* modify it under the terms of the GNU General Public License +* as published by the Free Software Foundation; either version 2 +* of the License, or (at your option) any later version. +* +* This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY +* KIND, either express or implied. +* +****************************************************************************/ + +#ifndef _LIB_WRAPPERS_H_ +#define _LIB_WRAPPERS_H_ + +#define open rb->open +#define close rb->close +#define read rb->read +#define lseek rb->lseek +#define memset rb->memset +#ifdef HAVE_ADJUSTABLE_CPU_FREQ +#define cpu_boost rb->cpu_boost +#endif +#define yield rb->yield +#if CONFIG_CODEC == SWCODEC +#define align_buffer rb->align_buffer +#endif + +#endif + Property changes on: apps/plugins/lib/wrappers.h ___________________________________________________________________ Added: svn:mergeinfo -/*************************************************************************** -* __________ __ ___. -* Open \______ \ ____ ____ | | _\_ |__ _______ ___ -* Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ / -* Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < < -* Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \ -* \/ \/ \/ \/ \/ -* $Id$ -* -* This is a wrapper for the core bmp.c -* -* This program is free software; you can redistribute it and/or -* modify it under the terms of the GNU General Public License -* as published by the Free Software Foundation; either version 2 -* of the License, or (at your option) any later version. -* -* This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY -* KIND, either express or implied. -* -****************************************************************************/ - -#include <plugin.h> -#include "../../recorder/resize.c" - rgb_hsv.c #if defined(HAVE_LCD_BITMAP) && (LCD_DEPTH < 4) #if LCD_DEPTH == 1 -core_bmp.c -core_resize.c +resize.c #endif grey_core.c grey_draw.c xlcd_core.c xlcd_draw.c xlcd_scroll.c -#if LCD_DEPTH>1 bmp.c -#endif #ifdef HAVE_LCD_COLOR bmp_smooth_scale.c #endif * $Id$ * * Copyright (C) 2006 by Antoine Cellerier <dionoea -at- videolan -dot- org> + * Copyright (C) 2009 by Andrew Mahone * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU General Public License #include "lcd.h" #include "system.h" +#if LCD_DEPTH > 1 #ifdef HAVE_LCD_COLOR #define LE16(x) (htole16(x))&0xff, ((htole16(x))>>8)&0xff #define LE32(x) (htole32(x))&0xff, ((htole32(x))>>8)&0xff, ((htole32(x))>>16)&0xff, ((htole32(x))>>24)&0xff yr += yrstep; } } + +#else +#include "wrappers.h" + +static const struct plugin_api *rb; + +#include "../../recorder/bmp.c" + +void bmp_init(const struct plugin_api *api) +{ + rb = api; +} +#endif #include "lcd.h" #include "plugin.h" +#if LCD_DEPTH > 1 #ifdef HAVE_LCD_COLOR /** * Save bitmap to file */ void smooth_resize_bitmap(struct bitmap *src, struct bitmap *dst); +#else +void bmp_init(const struct plugin_api *api); #endif + +#endif -/*************************************************************************** -* __________ __ ___. -* Open \______ \ ____ ____ | | _\_ |__ _______ ___ -* Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ / -* Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < < -* Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \ -* \/ \/ \/ \/ \/ -* $Id$ -* -* This is a wrapper for the core bmp.c -* -* This program is free software; you can redistribute it and/or -* modify it under the terms of the GNU General Public License -* as published by the Free Software Foundation; either version 2 -* of the License, or (at your option) any later version. -* -* This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY -* KIND, either express or implied. -* -****************************************************************************/ - -#include <plugin.h> -#include "../../recorder/bmp.c" - |