Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 226209
b: refs/heads/master
c: 2997137
h: refs/heads/master
i:
  226207: 34c0dae
v: v3
  • Loading branch information
David Härdeman authored and Mauro Carvalho Chehab committed Dec 29, 2010
1 parent 13e3615 commit cb79ac4
Show file tree
Hide file tree
Showing 5 changed files with 38 additions and 266 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: 00df055ae315c9c8792dc4d012e6ad9c4d527e87
refs/heads/master: 2997137be8eba5bf9c07a24d5fda1f4225f9ca7d
134 changes: 0 additions & 134 deletions trunk/drivers/media/IR/ir-functions.c
Original file line number Diff line number Diff line change
Expand Up @@ -111,140 +111,6 @@ u32 ir_extract_bits(u32 data, u32 mask)
}
EXPORT_SYMBOL_GPL(ir_extract_bits);

static int inline getbit(u32 *samples, int bit)
{
return (samples[bit/32] & (1 << (31-(bit%32)))) ? 1 : 0;
}

/* sump raw samples for visual debugging ;) */
int ir_dump_samples(u32 *samples, int count)
{
int i, bit, start;

printk(KERN_DEBUG "ir samples: ");
start = 0;
for (i = 0; i < count * 32; i++) {
bit = getbit(samples,i);
if (bit)
start = 1;
if (0 == start)
continue;
printk("%s", bit ? "#" : "_");
}
printk("\n");
return 0;
}
EXPORT_SYMBOL_GPL(ir_dump_samples);

/* decode raw samples, pulse distance coding used by NEC remotes */
int ir_decode_pulsedistance(u32 *samples, int count, int low, int high)
{
int i,last,bit,len;
u32 curBit;
u32 value;

/* find start burst */
for (i = len = 0; i < count * 32; i++) {
bit = getbit(samples,i);
if (bit) {
len++;
} else {
if (len >= 29)
break;
len = 0;
}
}

/* start burst to short */
if (len < 29)
return 0xffffffff;

/* find start silence */
for (len = 0; i < count * 32; i++) {
bit = getbit(samples,i);
if (bit) {
break;
} else {
len++;
}
}

/* silence to short */
if (len < 7)
return 0xffffffff;

/* go decoding */
len = 0;
last = 1;
value = 0; curBit = 1;
for (; i < count * 32; i++) {
bit = getbit(samples,i);
if (last) {
if(bit) {
continue;
} else {
len = 1;
}
} else {
if (bit) {
if (len > (low + high) /2)
value |= curBit;
curBit <<= 1;
if (curBit == 1)
break;
} else {
len++;
}
}
last = bit;
}

return value;
}
EXPORT_SYMBOL_GPL(ir_decode_pulsedistance);

/* decode raw samples, biphase coding, used by rc5 for example */
int ir_decode_biphase(u32 *samples, int count, int low, int high)
{
int i,last,bit,len,flips;
u32 value;

/* find start bit (1) */
for (i = 0; i < 32; i++) {
bit = getbit(samples,i);
if (bit)
break;
}

/* go decoding */
len = 0;
flips = 0;
value = 1;
for (; i < count * 32; i++) {
if (len > high)
break;
if (flips > 1)
break;
last = bit;
bit = getbit(samples,i);
if (last == bit) {
len++;
continue;
}
if (len < low) {
len++;
flips++;
continue;
}
value <<= 1;
value |= bit;
flips = 0;
len = 1;
}
return value;
}
EXPORT_SYMBOL_GPL(ir_decode_biphase);

/* RC5 decoding stuff, moved from bttv-input.c to share it with
* saa7134 */

Expand Down
2 changes: 1 addition & 1 deletion trunk/drivers/media/video/cx88/Kconfig
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
config VIDEO_CX88
tristate "Conexant 2388x (bt878 successor) support"
depends on VIDEO_DEV && PCI && I2C && INPUT
depends on VIDEO_DEV && PCI && I2C && INPUT && IR_CORE
select I2C_ALGOBIT
select VIDEO_BTCX
select VIDEOBUF_DMA_SG
Expand Down
Loading

0 comments on commit cb79ac4

Please sign in to comment.