[FFmpeg-devel] [PATCH 09/12] WMA: store level_table as floats, use type punning for sign flip in decode

Alex Converse alex.converse
Mon Sep 28 02:03:03 CEST 2009


On Sun, Sep 27, 2009 at 6:49 AM, Mans Rullgard <mans at mansr.com> wrote:
> ---
> ?libavcodec/wma.c ? ? ? ?| ? 19 +++++++++++++------
> ?libavcodec/wma.h ? ? ? ?| ? ?4 ++--
> ?libavcodec/wmaprodata.h | ? ?4 ++--
> ?libavcodec/wmaprodec.c ?| ? ?2 +-
> ?4 files changed, 18 insertions(+), 11 deletions(-)
>

> @@ -465,19 +469,22 @@ unsigned int ff_wma_get_large_val(GetBitContext* gb)
> ?*/
> ?int ff_wma_run_level_decode(AVCodecContext* avctx, GetBitContext* gb,
> ? ? ? ? ? ? ? ? ? ? ? ? ? ? VLC *vlc,
> - ? ? ? ? ? ? ? ? ? ? ? ? ? ?const uint16_t *level_table, const uint16_t *run_table,
> + ? ? ? ? ? ? ? ? ? ? ? ? ? ?const float *level_table, const uint16_t *run_table,
> ? ? ? ? ? ? ? ? ? ? ? ? ? ? int version, WMACoef *ptr, int offset,
> ? ? ? ? ? ? ? ? ? ? ? ? ? ? int num_coefs, int block_len, int frame_len_bits,
> ? ? ? ? ? ? ? ? ? ? ? ? ? ? int coef_nb_bits)
> ?{
> ? ? int code, level, sign;
> + ? ?const uint32_t *ilvl = (const uint32_t*)level_table;
> + ? ?uint32_t *iptr = (uint32_t*)ptr;
> ? ? const unsigned int coef_mask = block_len - 1;
> ? ? for (; offset < num_coefs; offset++) {
> ? ? ? ? code = get_vlc2(gb, vlc->table, VLCBITS, VLCMAX);
> ? ? ? ? if (code > 1) {
> ? ? ? ? ? ? /** normal code */
> ? ? ? ? ? ? offset += run_table[code];

Is this legitimate under strict aliasing rules?



More information about the ffmpeg-devel mailing list