Ticket #1399: myth.diff

File myth.diff, 2.1 KB (added by ovek@…, 18 years ago)

Patch to libmythtv

  • libs/libmythtv/vbitext/cc.cpp

    old new  
    5858}
    5959
    6060
    61 static int decodebit(unsigned char *data, int threshold)
     61static int decodebit(unsigned char *data, int threshold, int scale1)
    6262{
    6363    int i, sum = 0;
    64     for (i = 0; i < 23; i++)
     64    for (i = 0; i < scale1; i++)
    6565        sum += data[i];
    66     return (sum > threshold * 23);
     66    return (sum > threshold * scale1);
    6767}
    6868
    6969
    70 static int decode(unsigned char *vbiline)
     70static int decode(unsigned char *vbiline, int scale0, int scale1)
    7171{
    7272    int max[7], min[7], val[7], i, clk, tmp, sample, packedbits = 0;
    7373
     
    107107
    108108    for (i = min[6]; vbiline[i] < sample; i++);
    109109
    110     tmp = i + 57;
     110    tmp = i + scale0;
    111111    for (i = 0; i < 16; i++)
    112         if (decodebit(&vbiline[tmp + i * 57], sample))
     112        if (decodebit(&vbiline[tmp + i * scale0], sample, scale1))
    113113            packedbits |= 1 << i;
    114114    return packedbits & parityok(packedbits);
    115115}
     
    236236    int sl     = cc->start_line;
    237237    int l21_f1 = spl * (21 - sl);
    238238    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);
    241241}
  • libs/libmythtv/vbitext/cc.h

    old new  
    1616    int samples_per_line;
    1717    int start_line;
    1818    int line_count;
     19    int scale0, scale1;
    1920};
    2021
    2122int cc_decode(unsigned char *vbiline);
  • libs/libmythtv/NuppelVideoRecorder.cpp

    old new  
    26002600        ntsc_cc->samples_per_line = vfmt.samples_per_line;
    26012601        ntsc_cc->start_line       = vfmt.start[0];
    26022602        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% */
    26032605        ptr_end = ntsc_cc->buffer + sz;
    26042606        if (sz > CC_VBIBUFSIZE)
    26052607        {