Lines Matching +full:3 +full:- +full:line
1 // SPDX-License-Identifier: GPL-2.0-or-later
5 * Derived from ivtv-vbi.c
10 #include "cx18-driver.h"
11 #include "cx18-vbi.h"
12 #include "cx18-ioctl.h"
13 #include "cx18-queue.h"
18 * of VBI sample or VBI ancillary data regions in the digital ratser line.
27 int line = 0; in copy_vbi_data() local
32 /* MPEG-2 Program Pack */ in copy_vbi_data()
37 /* MPEG-2 Private Stream 1 PES Packet */ in copy_vbi_data()
45 int idx = cx->vbi.frame % CX18_VBI_FRAMES; in copy_vbi_data()
46 u8 *dst = &cx->vbi.sliced_mpeg_data[idx][0]; in copy_vbi_data()
49 struct v4l2_sliced_vbi_data *sdata = cx->vbi.sliced_data + i; in copy_vbi_data()
52 if (sdata->id == 0) in copy_vbi_data()
55 l = sdata->line - 6; in copy_vbi_data()
56 f = sdata->field; in copy_vbi_data()
62 linemask[1] |= (1 << (l - 32)); in copy_vbi_data()
63 dst[sd + 12 + line * 43] = cx18_service2vbi(sdata->id); in copy_vbi_data()
64 memcpy(dst + sd + 12 + line * 43 + 1, sdata->data, 42); in copy_vbi_data()
65 line++; in copy_vbi_data()
68 if (line == 36) { in copy_vbi_data()
73 memmove(dst + sd + 4, dst + sd + 12, line * 43); in copy_vbi_data()
74 size = 4 + ((43 * line + 3) & ~3); in copy_vbi_data()
80 size = 12 + ((43 * line + 3) & ~3); in copy_vbi_data()
89 cx->vbi.sliced_mpeg_size[idx] = sd + size; in copy_vbi_data()
94 /* FIXME - this function ignores the input size. */
98 u32 lines = cx->vbi.count * 2; in compress_raw_buf()
111 (p[3] != raw_vbi_sav_rp[0] && in compress_raw_buf()
112 p[3] != raw_vbi_sav_rp[1])) in compress_raw_buf()
114 if (i == lines - 1) { in compress_raw_buf()
115 /* last line is hdr_size bytes short - extrapolate it */ in compress_raw_buf()
116 memcpy(q, p + 4, line_size - 4 - hdr_size); in compress_raw_buf()
117 q += line_size - 4 - hdr_size; in compress_raw_buf()
118 p += line_size - hdr_size - 1; in compress_raw_buf()
121 memcpy(q, p + 4, line_size - 4); in compress_raw_buf()
122 q += line_size - 4; in compress_raw_buf()
125 return lines * (line_size - 4); in compress_raw_buf()
133 u32 line = 0; in compress_sliced_buf() local
134 u32 line_size = cx->is_60hz ? VBI_HBLANK_SAMPLES_60HZ in compress_sliced_buf()
137 /* find the first valid line */ in compress_sliced_buf()
140 (buf[3] == sliced_vbi_eav_rp[0] || in compress_sliced_buf()
141 buf[3] == sliced_vbi_eav_rp[1])) in compress_sliced_buf()
146 * The last line is short by hdr_size bytes, but for the remaining in compress_sliced_buf()
150 size -= (i - hdr_size); in compress_sliced_buf()
152 return line; in compress_sliced_buf()
159 (p[3] != sliced_vbi_eav_rp[0] && in compress_sliced_buf()
160 p[3] != sliced_vbi_eav_rp[1])) in compress_sliced_buf()
163 v4l2_subdev_call(cx->sd_av, vbi, decode_vbi_line, &vbi); in compress_sliced_buf()
165 cx->vbi.sliced_data[line].id = vbi.type; in compress_sliced_buf()
166 cx->vbi.sliced_data[line].field = vbi.is_second_field; in compress_sliced_buf()
167 cx->vbi.sliced_data[line].line = vbi.line; in compress_sliced_buf()
168 memcpy(cx->vbi.sliced_data[line].data, vbi.p, 42); in compress_sliced_buf()
169 line++; in compress_sliced_buf()
172 return line; in compress_sliced_buf()
185 } *hdr = (struct vbi_data_hdr *) buf->buf; in _cx18_process_vbi_data()
187 u8 *p = (u8 *) buf->buf; in _cx18_process_vbi_data()
188 u32 size = buf->bytesused; in _cx18_process_vbi_data()
193 * The CX23418 sends us data that is 32 bit little-endian swapped, in _cx18_process_vbi_data()
195 * line. This has a side effect of making the header big endian in _cx18_process_vbi_data()
202 size = buf->bytesused = in _cx18_process_vbi_data()
209 p += size - 4; in _cx18_process_vbi_data()
210 memcpy(p, &cx->vbi.frame, 4); in _cx18_process_vbi_data()
211 cx->vbi.frame++; in _cx18_process_vbi_data()
217 pts = (be32_to_cpu(hdr->magic) == 0x3fffffff) ? be32_to_cpu(hdr->pts) in _cx18_process_vbi_data()
222 /* always return at least one empty line */ in _cx18_process_vbi_data()
224 cx->vbi.sliced_data[0].id = 0; in _cx18_process_vbi_data()
225 cx->vbi.sliced_data[0].line = 0; in _cx18_process_vbi_data()
226 cx->vbi.sliced_data[0].field = 0; in _cx18_process_vbi_data()
229 buf->bytesused = size = lines * sizeof(cx->vbi.sliced_data[0]); in _cx18_process_vbi_data()
230 memcpy(p, &cx->vbi.sliced_data[0], size); in _cx18_process_vbi_data()
232 if (cx->vbi.insert_mpeg) in _cx18_process_vbi_data()
234 cx->vbi.frame++; in _cx18_process_vbi_data()
256 list_for_each_entry(buf, &mdl->buf_list, list) { in cx18_process_vbi_data()
257 orig_used = buf->bytesused; in cx18_process_vbi_data()
261 mdl->bytesused -= (orig_used - buf->bytesused); in cx18_process_vbi_data()