Lines Matching refs:ctx

117 static int hq_decode_frame(HQContext *ctx, AVFrame *pic,
122 const uint8_t *perm, *src = ctx->gbc.buffer;
128 avpriv_request_sample(ctx->avctx, "HQ Profile %d", prof_num);
131 av_log(ctx->avctx, AV_LOG_VERBOSE, "HQ Profile %d\n", prof_num);
134 ctx->avctx->coded_width = FFALIGN(profile->width, 16);
135 ctx->avctx->coded_height = FFALIGN(profile->height, 16);
136 ctx->avctx->width = profile->width;
137 ctx->avctx->height = profile->height;
138 ctx->avctx->bits_per_raw_sample = 8;
139 ctx->avctx->pix_fmt = AV_PIX_FMT_YUV422P;
141 ret = ff_get_buffer(ctx->avctx, pic, 0);
147 slice_off[i] = bytestream2_get_be24(&ctx->gbc) - 4;
158 av_log(ctx->avctx, AV_LOG_ERROR,
166 ret = hq_decode_mb(ctx, pic, &gb, perm[0] * 16, perm[1] * 16);
168 av_log(ctx->avctx, AV_LOG_ERROR,
222 static int hqa_decode_slice(HQContext *ctx, AVFrame *pic, GetBitContext *gb,
231 ret = hqa_decode_mb(ctx, pic, quant, gb, j, i);
233 av_log(ctx->avctx, AV_LOG_ERROR,
243 static int hqa_decode_frame(HQContext *ctx, AVFrame *pic, size_t data_size)
250 const uint8_t *src = ctx->gbc.buffer;
252 if (bytestream2_get_bytes_left(&ctx->gbc) < 8 + 4*(num_slices + 1))
255 width = bytestream2_get_be16(&ctx->gbc);
256 height = bytestream2_get_be16(&ctx->gbc);
258 ret = ff_set_dimensions(ctx->avctx, width, height);
262 ctx->avctx->coded_width = FFALIGN(width, 16);
263 ctx->avctx->coded_height = FFALIGN(height, 16);
264 ctx->avctx->bits_per_raw_sample = 8;
265 ctx->avctx->pix_fmt = AV_PIX_FMT_YUVA422P;
267 av_log(ctx->avctx, AV_LOG_VERBOSE, "HQA Profile\n");
269 quant = bytestream2_get_byte(&ctx->gbc);
270 bytestream2_skip(&ctx->gbc, 3);
272 av_log(ctx->avctx, AV_LOG_ERROR,
277 ret = ff_get_buffer(ctx->avctx, pic, 0);
283 slice_off[i] = bytestream2_get_be32(&ctx->gbc) - 4;
289 av_log(ctx->avctx, AV_LOG_ERROR,
296 ret = hqa_decode_slice(ctx, pic, &gb, quant, slice, width, height);
307 HQContext *ctx = avctx->priv_data;
313 bytestream2_init(&ctx->gbc, avpkt->data, avpkt->size);
314 if (bytestream2_get_bytes_left(&ctx->gbc) < 4 + 4) {
319 info_tag = bytestream2_peek_le32(&ctx->gbc);
322 bytestream2_skip(&ctx->gbc, 4);
323 info_size = bytestream2_get_le32(&ctx->gbc);
324 if (info_size < 0 || bytestream2_get_bytes_left(&ctx->gbc) < info_size) {
328 ff_canopus_parse_info_tag(avctx, ctx->gbc.buffer, info_size);
330 bytestream2_skip(&ctx->gbc, info_size);
333 data_size = bytestream2_get_bytes_left(&ctx->gbc);
342 tag = bytestream2_get_le32(&ctx->gbc);
344 ret = hq_decode_frame(ctx, pic, tag >> 24, data_size);
346 ret = hqa_decode_frame(ctx, pic, data_size);
366 HQContext *ctx = avctx->priv_data;
367 ctx->avctx = avctx;
369 ff_hqdsp_init(&ctx->hqhqadsp);
371 return ff_hq_init_vlcs(ctx);
376 HQContext *ctx = avctx->priv_data;
378 ff_free_vlc(&ctx->hq_ac_vlc);
379 ff_free_vlc(&ctx->hqa_cbp_vlc);