Lines Matching refs:pc
56 static int find_frame_end(DiracParseContext *pc,
59 uint32_t state = pc->state;
62 if (!pc->is_synced) {
67 pc->is_synced = 1;
68 pc->header_bytes_needed = 9;
69 pc->sync_offset = i;
75 if (pc->is_synced) {
76 pc->sync_offset = 0;
79 if ((buf_size - i) >= pc->header_bytes_needed) {
80 pc->state = -1;
81 return i + pc->header_bytes_needed;
83 pc->header_bytes_needed = 9 - (buf_size - i);
90 pc->state = state;
100 static int unpack_parse_unit(DiracParseUnit *pu, DiracParseContext *pc,
110 if (offset < 0 || pc->index - 13 < offset)
113 start = pc->buffer + offset;
142 DiracParseContext *pc = s->priv_data;
144 if (pc->overread_index) {
145 memmove(pc->buffer, pc->buffer + pc->overread_index,
146 pc->index - pc->overread_index);
147 pc->index -= pc->overread_index;
148 pc->overread_index = 0;
149 if (*buf_size == 0 && pc->buffer[4] == 0x10) {
150 *buf = pc->buffer;
151 *buf_size = pc->index;
159 av_fast_realloc(pc->buffer, &pc->buffer_size,
160 pc->index + (*buf_size - pc->sync_offset));
163 pc->buffer = new_buffer;
164 memcpy(pc->buffer + pc->index, (*buf + pc->sync_offset),
165 *buf_size - pc->sync_offset);
166 pc->index += *buf_size - pc->sync_offset;
171 void *new_buffer = av_fast_realloc(pc->buffer, &pc->buffer_size,
172 pc->index + next);
175 pc->buffer = new_buffer;
176 memcpy(pc->buffer + pc->index, *buf, next);
177 pc->index += next;
185 if (!unpack_parse_unit(&pu1, pc, pc->index - 13) ||
186 !unpack_parse_unit(&pu, pc, pc->index - 13 - pu1.prev_pu_offset) ||
188 pc->index < pc->dirac_unit_size + 13LL + pu1.prev_pu_offset
190 pc->index -= 9;
192 pc->header_bytes_needed = 9;
200 pc->dirac_unit = pc->buffer + pc->index - 13 -
201 pu1.prev_pu_offset - pc->dirac_unit_size;
203 pc->dirac_unit_size += pu.next_pu_offset;
206 pc->header_bytes_needed = 9;
213 uint8_t *cur_pu = pc->buffer +
214 pc->index - 13 - pu1.prev_pu_offset;
228 *buf = pc->dirac_unit;
229 *buf_size = pc->dirac_unit_size;
231 pc->dirac_unit_size = 0;
232 pc->overread_index = pc->index - 13;
233 pc->header_bytes_needed = 9;
242 DiracParseContext *pc = s->priv_data;
254 next = find_frame_end(pc, buf, buf_size);
255 if (!pc->is_synced && next == -1)
270 DiracParseContext *pc = s->priv_data;
272 if (pc->buffer_size > 0)
273 av_freep(&pc->buffer);