Lines Matching +full:0 +full:e

38 #define PES_PRIVATE_STREAM_1 0xbd  /* PES: private_stream_1 */
52 0x00, 0x80, 0x40, 0xC0, 0x20, 0xA0, 0x60, 0xE0, 0x10, 0x90, 0x50, 0xD0,
53 0x30, 0xB0, 0x70, 0xF0, 0x08, 0x88, 0x48, 0xC8, 0x28, 0xA8, 0x68, 0xE8,
54 0x18, 0x98, 0x58, 0xD8, 0x38, 0xB8, 0x78, 0xF8, 0x04, 0x84, 0x44, 0xC4,
55 0x24, 0xA4, 0x64, 0xE4, 0x14, 0x94, 0x54, 0xD4, 0x34, 0xB4, 0x74, 0xF4,
56 0x0C, 0x8C, 0x4C, 0xCC, 0x2C, 0xAC, 0x6C, 0xEC, 0x1C, 0x9C, 0x5C, 0xDC,
57 0x3C, 0xBC, 0x7C, 0xFC, 0x02, 0x82, 0x42, 0xC2, 0x22, 0xA2, 0x62, 0xE2,
58 0x12, 0x92, 0x52, 0xD2, 0x32, 0xB2, 0x72, 0xF2, 0x0A, 0x8A, 0x4A, 0xCA,
59 0x2A, 0xAA, 0x6A, 0xEA, 0x1A, 0x9A, 0x5A, 0xDA, 0x3A, 0xBA, 0x7A, 0xFA,
60 0x06, 0x86, 0x46, 0xC6, 0x26, 0xA6, 0x66, 0xE6, 0x16, 0x96, 0x56, 0xD6,
61 0x36, 0xB6, 0x76, 0xF6, 0x0E, 0x8E, 0x4E, 0xCE, 0x2E, 0xAE, 0x6E, 0xEE,
62 0x1E, 0x9E, 0x5E, 0xDE, 0x3E, 0xBE, 0x7E, 0xFE, 0x01, 0x81, 0x41, 0xC1,
63 0x21, 0xA1, 0x61, 0xE1, 0x11, 0x91, 0x51, 0xD1, 0x31, 0xB1, 0x71, 0xF1,
64 0x09, 0x89, 0x49, 0xC9, 0x29, 0xA9, 0x69, 0xE9, 0x19, 0x99, 0x59, 0xD9,
65 0x39, 0xB9, 0x79, 0xF9, 0x05, 0x85, 0x45, 0xC5, 0x25, 0xA5, 0x65, 0xE5,
66 0x15, 0x95, 0x55, 0xD5, 0x35, 0xB5, 0x75, 0xF5, 0x0D, 0x8D, 0x4D, 0xCD,
67 0x2D, 0xAD, 0x6D, 0xED, 0x1D, 0x9D, 0x5D, 0xDD, 0x3D, 0xBD, 0x7D, 0xFD,
68 0x03, 0x83, 0x43, 0xC3, 0x23, 0xA3, 0x63, 0xE3, 0x13, 0x93, 0x53, 0xD3,
69 0x33, 0xB3, 0x73, 0xF3, 0x0B, 0x8B, 0x4B, 0xCB, 0x2B, 0xAB, 0x6B, 0xEB,
70 0x1B, 0x9B, 0x5B, 0xDB, 0x3B, 0xBB, 0x7B, 0xFB, 0x07, 0x87, 0x47, 0xC7,
71 0x27, 0xA7, 0x67, 0xE7, 0x17, 0x97, 0x57, 0xD7, 0x37, 0xB7, 0x77, 0xF7,
72 0x0F, 0x8F, 0x4F, 0xCF, 0x2F, 0xAF, 0x6F, 0xEF, 0x1F, 0x9F, 0x5F, 0xDF,
73 0x3F, 0xBF, 0x7F, 0xFF,
165 static void vidtv_s302m_access_unit_destroy(struct vidtv_encoder *e) in vidtv_s302m_access_unit_destroy() argument
167 struct vidtv_access_unit *head = e->access_units; in vidtv_s302m_access_unit_destroy()
176 e->access_units = NULL; in vidtv_s302m_access_unit_destroy()
179 static void vidtv_s302m_alloc_au(struct vidtv_encoder *e) in vidtv_s302m_alloc_au() argument
184 if (e->sync && e->sync->is_video_encoder) { in vidtv_s302m_alloc_au()
185 sync_au = e->sync->access_units; in vidtv_s302m_alloc_au()
188 temp = vidtv_s302m_access_unit_init(e->access_units); in vidtv_s302m_alloc_au()
189 if (!e->access_units) in vidtv_s302m_alloc_au()
190 e->access_units = temp; in vidtv_s302m_alloc_au()
198 e->access_units = vidtv_s302m_access_unit_init(NULL); in vidtv_s302m_alloc_au()
202 vidtv_s302m_compute_sample_count_from_video(struct vidtv_encoder *e) in vidtv_s302m_compute_sample_count_from_video() argument
204 struct vidtv_access_unit *sync_au = e->sync->access_units; in vidtv_s302m_compute_sample_count_from_video()
205 struct vidtv_access_unit *au = e->access_units; in vidtv_s302m_compute_sample_count_from_video()
210 vau_duration_usecs = USEC_PER_SEC / e->sync->sampling_rate_hz; in vidtv_s302m_compute_sample_count_from_video()
211 sample_duration_usecs = USEC_PER_SEC / e->sampling_rate_hz; in vidtv_s302m_compute_sample_count_from_video()
221 static void vidtv_s302m_compute_pts_from_video(struct vidtv_encoder *e) in vidtv_s302m_compute_pts_from_video() argument
223 struct vidtv_access_unit *au = e->access_units; in vidtv_s302m_compute_pts_from_video()
224 struct vidtv_access_unit *sync_au = e->sync->access_units; in vidtv_s302m_compute_pts_from_video()
234 static u16 vidtv_s302m_get_sample(struct vidtv_encoder *e) in vidtv_s302m_get_sample() argument
238 struct vidtv_s302m_ctx *ctx = e->ctx; in vidtv_s302m_get_sample()
240 if (!e->src_buf) { in vidtv_s302m_get_sample()
245 if (ctx->last_duration <= 0) { in vidtv_s302m_get_sample()
246 if (e->src_buf_offset >= ARRAY_SIZE(beethoven_fur_elise)) in vidtv_s302m_get_sample()
247 e->src_buf_offset = 0; in vidtv_s302m_get_sample()
249 ctx->last_tone = beethoven_fur_elise[e->src_buf_offset].note; in vidtv_s302m_get_sample()
250 ctx->last_duration = beethoven_fur_elise[e->src_buf_offset].duration * in vidtv_s302m_get_sample()
252 e->src_buf_offset++; in vidtv_s302m_get_sample()
253 ctx->note_offset = 0; in vidtv_s302m_get_sample()
260 return 0x8000; in vidtv_s302m_get_sample()
265 return (fixp_sin32(pos % (2 * PI)) >> 16) + 0x8000; in vidtv_s302m_get_sample()
269 if (e->src_buf_offset > e->src_buf_sz) { in vidtv_s302m_get_sample()
271 e->src_buf_offset, in vidtv_s302m_get_sample()
272 e->src_buf_sz); in vidtv_s302m_get_sample()
274 e->src_buf_offset = 0; in vidtv_s302m_get_sample()
277 if (e->src_buf_offset >= e->src_buf_sz) { in vidtv_s302m_get_sample()
279 if (e->last_sample_cb) in vidtv_s302m_get_sample()
280 e->last_sample_cb(e->sample_count); in vidtv_s302m_get_sample()
282 e->src_buf_offset = 0; in vidtv_s302m_get_sample()
285 sample = *(u16 *)(e->src_buf + e->src_buf_offset); in vidtv_s302m_get_sample()
290 static u32 vidtv_s302m_write_frame(struct vidtv_encoder *e, in vidtv_s302m_write_frame() argument
293 struct vidtv_s302m_ctx *ctx = e->ctx; in vidtv_s302m_write_frame()
295 u32 nbytes = 0; in vidtv_s302m_write_frame()
299 u8 vucf = ctx->frame_index == 0 ? 0x10 : 0; in vidtv_s302m_write_frame()
301 f.data[0] = sample & 0xFF; in vidtv_s302m_write_frame()
302 f.data[1] = (sample & 0xFF00) >> 8; in vidtv_s302m_write_frame()
303 f.data[2] = ((sample & 0x0F) << 4) | vucf; in vidtv_s302m_write_frame()
304 f.data[3] = (sample & 0x0FF0) >> 4; in vidtv_s302m_write_frame()
305 f.data[4] = (sample & 0xF000) >> 12; in vidtv_s302m_write_frame()
307 f.data[0] = reverse[f.data[0]]; in vidtv_s302m_write_frame()
313 nbytes += vidtv_memcpy(e->encoder_buf, in vidtv_s302m_write_frame()
314 e->encoder_buf_offset, in vidtv_s302m_write_frame()
319 e->encoder_buf_offset += nbytes; in vidtv_s302m_write_frame()
323 ctx->frame_index = 0; in vidtv_s302m_write_frame()
328 static u32 vidtv_s302m_write_h(struct vidtv_encoder *e, u32 p_sz) in vidtv_s302m_write_h() argument
331 u32 nbytes = 0; in vidtv_s302m_write_h()
333 /* 2 channels, ident: 0, 16 bits per sample */ in vidtv_s302m_write_h()
336 nbytes += vidtv_memcpy(e->encoder_buf, in vidtv_s302m_write_h()
337 e->encoder_buf_offset, in vidtv_s302m_write_h()
338 e->encoder_buf_sz, in vidtv_s302m_write_h()
342 e->encoder_buf_offset += nbytes; in vidtv_s302m_write_h()
346 static void vidtv_s302m_write_frames(struct vidtv_encoder *e) in vidtv_s302m_write_frames() argument
348 struct vidtv_access_unit *au = e->access_units; in vidtv_s302m_write_frames()
349 struct vidtv_s302m_ctx *ctx = e->ctx; in vidtv_s302m_write_frames()
350 u32 nbytes_per_unit = 0; in vidtv_s302m_write_frames()
351 u32 nbytes = 0; in vidtv_s302m_write_frames()
352 u32 au_sz = 0; in vidtv_s302m_write_frames()
360 nbytes_per_unit = vidtv_s302m_write_h(e, au_sz); in vidtv_s302m_write_frames()
362 for (j = 0; j < au->num_samples; ++j) { in vidtv_s302m_write_frames()
363 sample = vidtv_s302m_get_sample(e); in vidtv_s302m_write_frames()
364 nbytes_per_unit += vidtv_s302m_write_frame(e, sample); in vidtv_s302m_write_frames()
366 if (e->src_buf) in vidtv_s302m_write_frames()
367 e->src_buf_offset += sizeof(u16); in vidtv_s302m_write_frames()
369 e->sample_count++; in vidtv_s302m_write_frames()
383 nbytes_per_unit = 0; in vidtv_s302m_write_frames()
390 static void *vidtv_s302m_encode(struct vidtv_encoder *e) in vidtv_s302m_encode() argument
392 struct vidtv_s302m_ctx *ctx = e->ctx; in vidtv_s302m_encode()
407 vidtv_s302m_access_unit_destroy(e); in vidtv_s302m_encode()
408 vidtv_s302m_alloc_au(e); in vidtv_s302m_encode()
410 if (e->sync && e->sync->is_video_encoder) { in vidtv_s302m_encode()
411 vidtv_s302m_compute_sample_count_from_video(e); in vidtv_s302m_encode()
412 vidtv_s302m_compute_pts_from_video(e); in vidtv_s302m_encode()
414 e->access_units->num_samples = FF_S302M_DEFAULT_NUM_FRAMES; in vidtv_s302m_encode()
415 e->access_units->pts = (ctx->au_count * FF_S302M_DEFAULT_PTS_INCREMENT) + in vidtv_s302m_encode()
419 vidtv_s302m_write_frames(e); in vidtv_s302m_encode()
421 return e->encoder_buf; in vidtv_s302m_encode()
424 static u32 vidtv_s302m_clear(struct vidtv_encoder *e) in vidtv_s302m_clear() argument
426 struct vidtv_access_unit *au = e->access_units; in vidtv_s302m_clear()
427 u32 count = 0; in vidtv_s302m_clear()
434 vidtv_s302m_access_unit_destroy(e); in vidtv_s302m_clear()
435 memset(e->encoder_buf, 0, VIDTV_S302M_BUF_SZ); in vidtv_s302m_clear()
436 e->encoder_buf_offset = 0; in vidtv_s302m_clear()
446 struct vidtv_encoder *e; in vidtv_s302m_encoder_init() local
448 e = kzalloc(sizeof(*e), GFP_KERNEL); in vidtv_s302m_encoder_init()
449 if (!e) in vidtv_s302m_encoder_init()
452 e->id = S302M; in vidtv_s302m_encoder_init()
455 e->name = kstrdup(args.name, GFP_KERNEL); in vidtv_s302m_encoder_init()
457 e->encoder_buf = vzalloc(VIDTV_S302M_BUF_SZ); in vidtv_s302m_encoder_init()
458 if (!e->encoder_buf) in vidtv_s302m_encoder_init()
461 e->encoder_buf_sz = VIDTV_S302M_BUF_SZ; in vidtv_s302m_encoder_init()
462 e->encoder_buf_offset = 0; in vidtv_s302m_encoder_init()
464 e->sample_count = 0; in vidtv_s302m_encoder_init()
466 e->src_buf = (args.src_buf) ? args.src_buf : NULL; in vidtv_s302m_encoder_init()
467 e->src_buf_sz = (args.src_buf) ? args.src_buf_sz : 0; in vidtv_s302m_encoder_init()
468 e->src_buf_offset = 0; in vidtv_s302m_encoder_init()
470 e->is_video_encoder = false; in vidtv_s302m_encoder_init()
476 e->ctx = ctx; in vidtv_s302m_encoder_init()
477 ctx->last_duration = 0; in vidtv_s302m_encoder_init()
479 e->encode = vidtv_s302m_encode; in vidtv_s302m_encoder_init()
480 e->clear = vidtv_s302m_clear; in vidtv_s302m_encoder_init()
482 e->es_pid = cpu_to_be16(args.es_pid); in vidtv_s302m_encoder_init()
483 e->stream_id = cpu_to_be16(PES_PRIVATE_STREAM_1); in vidtv_s302m_encoder_init()
485 e->sync = args.sync; in vidtv_s302m_encoder_init()
486 e->sampling_rate_hz = S302M_SAMPLING_RATE_HZ; in vidtv_s302m_encoder_init()
488 e->last_sample_cb = args.last_sample_cb; in vidtv_s302m_encoder_init()
490 e->destroy = vidtv_s302m_encoder_destroy; in vidtv_s302m_encoder_init()
496 args.head->next = e; in vidtv_s302m_encoder_init()
499 e->next = NULL; in vidtv_s302m_encoder_init()
501 return e; in vidtv_s302m_encoder_init()
504 vfree(e->encoder_buf); in vidtv_s302m_encoder_init()
507 kfree(e->name); in vidtv_s302m_encoder_init()
508 kfree(e); in vidtv_s302m_encoder_init()
512 void vidtv_s302m_encoder_destroy(struct vidtv_encoder *e) in vidtv_s302m_encoder_destroy() argument
514 if (e->id != S302M) { in vidtv_s302m_encoder_destroy()
519 vidtv_s302m_access_unit_destroy(e); in vidtv_s302m_encoder_destroy()
520 kfree(e->name); in vidtv_s302m_encoder_destroy()
521 vfree(e->encoder_buf); in vidtv_s302m_encoder_destroy()
522 kfree(e->ctx); in vidtv_s302m_encoder_destroy()
523 kfree(e); in vidtv_s302m_encoder_destroy()