/* * Copyright (c) 2011 The WebM project authors. All Rights Reserved. * * Use of this source code is governed by a BSD-style license * that can be found in the LICENSE file in the root of the source * tree. An additional intellectual property rights grant can be found * in the file PATENTS. All contributing project authors may * be found in the AUTHORS file in the root of the source tree.
*/ #include <assert.h> #include <stdlib.h> #include"vpx_config.h" #include"lookahead.h" #include"vp8/common/extend.h"
struct lookahead_ctx { unsignedint max_sz; /* Absolute size of the queue */ unsignedint sz; /* Number of buffers currently in the queue */ unsignedint read_idx; /* Read index */ unsignedint write_idx; /* Write index */ struct lookahead_entry *buf; /* Buffer list */
};
/* Return the buffer at the given absolute index and increment the index */ staticstruct lookahead_entry *pop(struct lookahead_ctx *ctx, unsignedint *idx) { unsignedint index = *idx; struct lookahead_entry *buf = ctx->buf + index;
assert(index < ctx->max_sz); if (++index >= ctx->max_sz) index -= ctx->max_sz;
*idx = index; return buf;
}
void vp8_lookahead_destroy(struct lookahead_ctx *ctx) { if (ctx) { if (ctx->buf) { unsignedint i;
for (i = 0; i < ctx->max_sz; ++i) {
vp8_yv12_de_alloc_frame_buffer(&ctx->buf[i].img);
}
free(ctx->buf);
}
free(ctx);
}
}
/* Only do this partial copy if the following conditions are all met: * 1. Lookahead queue has has size of 1. * 2. Active map is provided. * 3. This is not a key frame, golden nor altref frame.
*/ if (ctx->max_sz == 1 && active_map && !flags) { for (row = 0; row < mb_rows; ++row) {
col = 0;
while (1) { /* Find the first active macroblock in this row. */ for (; col < mb_cols; ++col) { if (active_map[col]) break;
}
/* No more active macroblock in this row. */ if (col == mb_cols) break;
/* Find the end of active region in this row. */
active_end = col;
for (; active_end < mb_cols; ++active_end) { if (!active_map[active_end]) break;
}
/* Only copy this active region. */
vp8_copy_and_extend_frame_with_rect(src, &buf->img, row << 4, col << 4,
16, (active_end - col) << 4);
/* Start again from the end of this active region. */
col = active_end;
}
Die Informationen auf dieser Webseite wurden
nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit,
noch Qualität der bereit gestellten Informationen zugesichert.
Bemerkung:
Die farbliche Syntaxdarstellung und die Messung sind noch experimentell.