On 5 January 2012 21:39, Aneesh Dogra <[email protected]> wrote: > --- > libavcodec/apedec.c | 31 ++++++++++++++----------------- > 1 files changed, 14 insertions(+), 17 deletions(-) > > diff --git a/libavcodec/apedec.c b/libavcodec/apedec.c > index fa50d61..68850e6 100644 > --- a/libavcodec/apedec.c > +++ b/libavcodec/apedec.c > @@ -154,8 +154,7 @@ typedef struct APEContext { > APEFilter filters[APE_FILTER_LEVELS][2]; ///< filters used for > reconstruction > > uint8_t *data; ///< current frame data > - uint8_t *data_end; ///< frame data end > - const uint8_t *ptr; ///< current position in frame > data > + GetByteContext g; ///< current position in frame > data > > int error; > } APEContext; > @@ -240,7 +239,7 @@ filter_alloc_fail: > /** Start the decoder */ > static inline void range_start_decoding(APEContext *ctx) > { > - ctx->rc.buffer = bytestream_get_byte(&ctx->ptr); > + ctx->rc.buffer = bytestream2_get_byte(&ctx->g); > ctx->rc.low = ctx->rc.buffer >> (8 - EXTRA_BITS); > ctx->rc.range = (uint32_t) 1 << EXTRA_BITS; > } > @@ -250,9 +249,8 @@ static inline void range_dec_normalize(APEContext *ctx) > { > while (ctx->rc.range <= BOTTOM_VALUE) { > ctx->rc.buffer <<= 8; > - if(ctx->ptr < ctx->data_end) { > - ctx->rc.buffer += *ctx->ptr; > - ctx->ptr++; > + if(bytestream2_get_bytes_left(&ctx->g) >= 1) { > + ctx->rc.buffer += bytestream2_get_byteu(&ctx->g);
this looks like it can be replaced simply with ctx->rc.buffer += bytestream2_get_byte(&ctx->g); The rest looks fine (but since I'm looking at it through webmail interface I might be wrong). _______________________________________________ libav-devel mailing list [email protected] https://lists.libav.org/mailman/listinfo/libav-devel
