66 ctx->slot[
s]->slots &= ~(1 <<
s);
67 if (
ctx->slot[
s]->slots == 0)
79 unsigned int frame_marker;
80 unsigned int profile_low_bit, profile_high_bit, reserved_zero;
81 unsigned int error_resilient_mode;
89 if (frame_marker != 2) {
97 frame->profile = (profile_high_bit << 1) | profile_low_bit;
98 if (
frame->profile == 3) {
100 if (reserved_zero != 0) {
102 "unsupported profile or invalid bitstream.\n");
108 if (
frame->show_existing_frame) {
117 if (
frame->frame_type == 0) {
124 frame->refresh_frame_flags = 0xff;
128 if (
frame->show_frame == 0)
132 if (error_resilient_mode == 0) {
143 if (
frame->profile > 0) {
144 unsigned int color_space;
145 if (
frame->profile >= 2) {
150 if (color_space != 7 ) {
153 if (
frame->profile == 1 ||
frame->profile == 3) {
158 if (
frame->profile == 1 ||
frame->profile == 3)
177 *next_display = last_frame, *
frame;
187 if (
frame->needs_display && (!next_display ||
188 frame->pts < next_display->pts))
189 next_display =
frame;
199 frame = next_display;
201 if (
frame->needs_output &&
frame->needs_display &&
204 "%"PRId64
" (%"PRId64
") in order.\n",
209 frame->needs_output =
frame->needs_display = 0;
210 }
else if (
frame->needs_output) {
211 if (
frame->needs_display) {
213 "(%"PRId64
") for later display.\n",
217 "%"PRId64
" (%"PRId64
") to keep order.\n",
224 frame->needs_output = 0;
230 if (
frame->slots == 0) {
232 "which is no longer available?\n");
233 frame->needs_display = 0;
241 "(%"PRId64
") from slot %d.\n",
256 if (
frame->profile == 3) {
271 frame->needs_display = 0;
284 if (
ctx->next_frame) {
300 if ((in->
data[in->
size - 1] & 0xe0) == 0xc0) {
319 "frame: %d.\n", err);
323 frame->needs_output = 1;
326 if (
frame->show_existing_frame)
328 "(%"PRId64
"): show %u.\n",
frame->sequence,
332 "(%"PRId64
"): type %u show %u refresh %02x.\n",
334 frame->show_frame,
frame->refresh_frame_flags);
340 if (!(
frame->refresh_frame_flags & (1 <<
s)))
342 if (
ctx->slot[
s] &&
ctx->slot[
s]->needs_display &&
343 ctx->slot[
s]->slots == (1 <<
s)) {
351 "output overwriting slot %d: %d.\n",
364 if (!(
frame->refresh_frame_flags & (1 <<
s)))
370 if (!
frame->refresh_frame_flags) {
374 "for transient frame.\n");
378 if (!
frame->needs_display) {
408 .p.name =
"vp9_raw_reorder",
static av_cold const void * next_output(const AVOutputFormat *prev, AVClassCategory c2)
static av_cold void close(AVCodecParserContext *s)
simple assert() macros that are a bit more flexible than ISO C assert().
#define av_assert0(cond)
assert() equivalent, that is always enabled.
const FFBitStreamFilter ff_vp9_raw_reorder_bsf
int ff_bsf_get_packet(AVBSFContext *ctx, AVPacket **pkt)
Called by the bitstream filters to get the next packet for filtering.
static int FUNC frame_sync_code(CodedBitstreamContext *ctx, RWContext *rw, VP9RawFrameHeader *current)
void(* flush)(AVBSFContext *ctx)
bitstream reader API header.
static unsigned int get_bits1(GetBitContext *s)
static void skip_bits(GetBitContext *s, int n)
static unsigned int get_bits(GetBitContext *s, int n)
Read 1-25 bits.
static int init_get_bits(GetBitContext *s, const uint8_t *buffer, int bit_size)
Initialize GetBitContext.
AVCodecID
Identify the syntax and semantics of the bitstream.
void av_packet_free(AVPacket **pkt)
Free the packet, if the packet is reference counted, it will be unreferenced first.
void av_packet_move_ref(AVPacket *dst, AVPacket *src)
Move every field in src to dst and reset src.
int av_new_packet(AVPacket *pkt, int size)
Allocate the payload of a packet and initialize its fields with default values.
#define AVERROR_INVALIDDATA
Invalid data found when processing input.
#define AVERROR_EOF
End of file.
#define AV_LOG_DEBUG
Stuff which is only useful for libav* developers.
#define AV_LOG_ERROR
Something went wrong and cannot losslessly be recovered.
#define AV_NOPTS_VALUE
Undefined timestamp value.
static void put_bits(Jpeg2000EncoderContext *s, int val, int n)
put n times val bit
Memory handling functions.
static void init_put_bits(PutBitContext *s, uint8_t *buffer, int buffer_size)
Initialize the PutBitContext s.
static int put_bits_count(PutBitContext *s)
static void flush_put_bits(PutBitContext *s)
Pad the end of the output stream with zeros.
The bitstream filter state.
void * priv_data
Opaque filter-specific private data.
This structure stores compressed data.
int64_t pts
Presentation timestamp in AVStream->time_base units; the time at which the decompressed packet will b...
VP9RawReorderFrame * next_frame
VP9RawReorderFrame * slot[FRAME_SLOTS]
unsigned int refresh_frame_flags
unsigned int show_existing_frame
unsigned int frame_to_show
void(* filter)(uint8_t *src, ptrdiff_t stride, int qscale)
static AVFormatContext * ctx
static int vp9_raw_reorder_make_output(AVBSFContext *bsf, AVPacket *out, VP9RawReorderFrame *last_frame)
static int vp9_raw_reorder_filter(AVBSFContext *bsf, AVPacket *out)
static void vp9_raw_reorder_frame_free(VP9RawReorderFrame **frame)
static void vp9_raw_reorder_clear_slot(VP9RawReorderContext *ctx, int s)
static av_cold void vp9_raw_reorder_flush_close(AVBSFContext *bsf)
static enum AVCodecID vp9_raw_reorder_codec_ids[]
static int vp9_raw_reorder_frame_parse(AVBSFContext *bsf, VP9RawReorderFrame *frame)