/* * Copyright (C) 2006 Aurelien Jacobs <aurel@gnuage.org> * * This file is part of FFmpeg. * * FFmpeg is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; either * version 2.1 of the License, or (at your option) any later version. * * FFmpeg is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with FFmpeg; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*/
/** * @file * Common VP5-VP9 range decoder stuff
*/
typedefstruct VPXRangeCoder { int high; int bits; /* stored negated (i.e. negative "bits" is a positive number of
bits left) in order to eliminate a negate in cache refilling */ const uint8_t *buffer; const uint8_t *end; unsignedint code_word; int end_reached;
} VPXRangeCoder;
externconst uint8_t ff_vpx_norm_shift[256]; int ff_vpx_init_range_decoder(VPXRangeCoder *c, const uint8_t *buf, int buf_size);
/** * returns 1 if the end of the stream has been reached, 0 otherwise.
*/ static av_always_inline int vpx_rac_is_end(VPXRangeCoder *c)
{ if (c->end <= c->buffer && c->bits >= 0)
c->end_reached ++; return c->end_reached > 10;
}
static av_always_inline unsignedint vpx_rac_renorm(VPXRangeCoder *c)
{ int shift = ff_vpx_norm_shift[c->high]; int bits = c->bits; unsignedint code_word = c->code_word;
c->high = bit ? c->high - low : low;
c->code_word = bit ? code_word - low_shift : code_word;
return bit;
} #endif
#ifndef vpx_rac_get_prob_branchy // branchy variant, to be used where there's a branch based on the bit decoded static av_always_inline int vpx_rac_get_prob_branchy(VPXRangeCoder *c, int prob)
{ unsignedlong code_word = vpx_rac_renorm(c); unsigned low = 1 + (((c->high - 1) * prob) >> 8); unsigned low_shift = low << 16;
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.