/* Seach from the current directory up to the root looking for a ".badpixels" file, and fix those pixels now. */ void CLASS bad_pixels (const char *cfname) { FILE *fp=NULL; #ifndef LIBRAW_LIBRARY_BUILD char *fname, *cp, line[128]; int len, time, row, col, r, c, rad, tot, n, fixed=0; #else char *cp, line[128]; int time, row, col, r, c, rad, tot, n; #ifdef DCRAW_VERBOSE int fixed = 0; #endif #endif if (!filters) return; #ifdef LIBRAW_LIBRARY_BUILD RUN_CALLBACK(LIBRAW_PROGRESS_BAD_PIXELS,0,2); #endif if (cfname) fp = fopen (cfname, "r"); #line 4151 "dcraw/dcraw.c" if (!fp) { #ifdef LIBRAW_LIBRARY_BUILD imgdata.process_warnings |= LIBRAW_WARN_NO_BADPIXELMAP; #endif return; } while (fgets (line, 128, fp)) { cp = strchr (line, '#'); if (cp) *cp = 0; if (sscanf (line, "%d %d %d", &col, &row, &time) != 3) continue; if ((unsigned) col >= width || (unsigned) row >= height) continue; if (time > timestamp) continue; for (tot=n=0, rad=1; rad < 3 && n==0; rad++) for (r = row-rad; r <= row+rad; r++) for (c = col-rad; c <= col+rad; c++) if ((unsigned) r < height && (unsigned) c < width && (r != row || c != col) && fcol(r,c) == fcol(row,col)) { tot += BAYER2(r,c); n++; } BAYER2(row,col) = tot/n; #ifdef DCRAW_VERBOSE if (verbose) { if (!fixed++) fprintf (stderr,_("Fixed dead pixels at:")); fprintf (stderr, " %d,%d", col, row); } #endif } #ifdef DCRAW_VERBOSE if (fixed) fputc ('\n', stderr); #endif fclose (fp); #ifdef LIBRAW_LIBRARY_BUILD RUN_CALLBACK(LIBRAW_PROGRESS_BAD_PIXELS,1,2); #endif }
} static int midi_playback_open(struct snd_rawmidi_substream *substream) { struct snd_oxfw *oxfw = substream->rmidi->private_data; int err; err = snd_oxfw_stream_lock_try(oxfw); if (err < 0) return err; mutex_lock(&oxfw->mutex); oxfw->playback_substreams++; err = snd_oxfw_stream_start_simplex(oxfw, &oxfw->rx_stream, 0, 0); mutex_unlock(&oxfw->mutex); if (err < 0) snd_oxfw_stream_lock_release(oxfw); return err; } static int midi_capture_close(struct snd_rawmidi_substream *substream) { struct snd_oxfw *oxfw = substream->rmidi->private_data; mutex_lock(&oxfw->mutex); oxfw->capture_substreams--; snd_oxfw_stream_stop_simplex(oxfw, &oxfw->tx_stream); mutex_unlock(&oxfw->mutex); snd_oxfw_stream_lock_release(oxfw); return 0; } static int midi_playback_close(struct snd_rawmidi_substream *substream) { struct snd_oxfw *oxfw = substream->rmidi->private_data; mutex_lock(&oxfw->mutex); oxfw->playback_substreams--; snd_oxfw_stream_stop_simplex(oxfw, &oxfw->rx_stream); mutex_unlock(&oxfw->mutex); snd_oxfw_stream_lock_release(oxfw); return 0; } static void midi_capture_trigger(struct snd_rawmidi_substream *substrm, int up) { struct snd_oxfw *oxfw = substrm->rmidi->private_data; unsigned long flags; spin_lock_irqsave(&oxfw->lock, flags); if (up)