Ticket #1399: myth.diff
File myth.diff, 2.1 KB (added by , 18 years ago) |
---|
-
libs/libmythtv/vbitext/cc.cpp
old new 58 58 } 59 59 60 60 61 static int decodebit(unsigned char *data, int threshold )61 static int decodebit(unsigned char *data, int threshold, int scale1) 62 62 { 63 63 int i, sum = 0; 64 for (i = 0; i < 23; i++)64 for (i = 0; i < scale1; i++) 65 65 sum += data[i]; 66 return (sum > threshold * 23);66 return (sum > threshold * scale1); 67 67 } 68 68 69 69 70 static int decode(unsigned char *vbiline )70 static int decode(unsigned char *vbiline, int scale0, int scale1) 71 71 { 72 72 int max[7], min[7], val[7], i, clk, tmp, sample, packedbits = 0; 73 73 … … 107 107 108 108 for (i = min[6]; vbiline[i] < sample; i++); 109 109 110 tmp = i + 57;110 tmp = i + scale0; 111 111 for (i = 0; i < 16; i++) 112 if (decodebit(&vbiline[tmp + i * 57], sample))112 if (decodebit(&vbiline[tmp + i * scale0], sample, scale1)) 113 113 packedbits |= 1 << i; 114 114 return packedbits & parityok(packedbits); 115 115 } … … 236 236 int sl = cc->start_line; 237 237 int l21_f1 = spl * (21 - sl); 238 238 int l21_f2 = spl * (cc->line_count + 21 - sl); 239 cc->code1 = decode((unsigned char *)(cc->buffer + l21_f1) );240 cc->code2 = decode((unsigned char *)(cc->buffer + l21_f2) );239 cc->code1 = decode((unsigned char *)(cc->buffer + l21_f1), cc->scale0, cc->scale1); 240 cc->code2 = decode((unsigned char *)(cc->buffer + l21_f2), cc->scale0, cc->scale1); 241 241 } -
libs/libmythtv/vbitext/cc.h
old new 16 16 int samples_per_line; 17 17 int start_line; 18 18 int line_count; 19 int scale0, scale1; 19 20 }; 20 21 21 22 int cc_decode(unsigned char *vbiline); -
libs/libmythtv/NuppelVideoRecorder.cpp
old new 2600 2600 ntsc_cc->samples_per_line = vfmt.samples_per_line; 2601 2601 ntsc_cc->start_line = vfmt.start[0]; 2602 2602 ntsc_cc->line_count = vfmt.count[0]; 2603 ntsc_cc->scale0 = (vfmt.sampling_rate + 503488/2) / 503488; 2604 ntsc_cc->scale1 = (ntsc_cc->scale0*2+3)/5; /* 40% */ 2603 2605 ptr_end = ntsc_cc->buffer + sz; 2604 2606 if (sz > CC_VBIBUFSIZE) 2605 2607 {