• Main Page
  • Related Pages
  • Modules
  • Data Structures
  • Files
  • Examples
  • File List
  • Globals

libavcodec/proresdsp.c

Go to the documentation of this file.
00001 /*
00002  * Apple ProRes compatible decoder
00003  *
00004  * Copyright (c) 2010-2011 Maxim Poliakovski
00005  *
00006  * This file is part of Libav.
00007  *
00008  * Libav is free software; you can redistribute it and/or
00009  * modify it under the terms of the GNU Lesser General Public
00010  * License as published by the Free Software Foundation; either
00011  * version 2.1 of the License, or (at your option) any later version.
00012  *
00013  * Libav is distributed in the hope that it will be useful,
00014  * but WITHOUT ANY WARRANTY; without even the implied warranty of
00015  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
00016  * Lesser General Public License for more details.
00017  *
00018  * You should have received a copy of the GNU Lesser General Public
00019  * License along with Libav; if not, write to the Free Software
00020  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
00021  */
00022 
00023 #include "proresdsp.h"
00024 #include "simple_idct.h"
00025 
00026 #define BIAS     (1 << (PRORES_BITS_PER_SAMPLE - 1))           ///< bias value for converting signed pixels into unsigned ones
00027 #define CLIP_MIN (1 << (PRORES_BITS_PER_SAMPLE - 8))           ///< minimum value for clipping resulting pixels
00028 #define CLIP_MAX (1 << PRORES_BITS_PER_SAMPLE) - CLIP_MIN - 1  ///< maximum value for clipping resulting pixels
00029 
00030 #define CLIP_AND_BIAS(x) (av_clip((x) + BIAS, CLIP_MIN, CLIP_MAX))
00031 
00035 static void put_pixels(uint16_t *dst, int stride, const DCTELEM *in)
00036 {
00037     int x, y, src_offset, dst_offset;
00038 
00039     for (y = 0, dst_offset = 0; y < 8; y++, dst_offset += stride) {
00040         for (x = 0; x < 8; x++) {
00041             src_offset = (y << 3) + x;
00042 
00043             dst[dst_offset + x] = CLIP_AND_BIAS(in[src_offset]);
00044         }
00045     }
00046 }
00047 
00048 static void prores_idct_put_c(uint16_t *out, int linesize, DCTELEM *block, const int16_t *qmat)
00049 {
00050     ff_prores_idct(block, qmat);
00051     put_pixels(out, linesize >> 1, block);
00052 }
00053 
00054 void ff_proresdsp_init(ProresDSPContext *dsp)
00055 {
00056     dsp->idct_put = prores_idct_put_c;
00057     dsp->idct_permutation_type = FF_NO_IDCT_PERM;
00058 
00059     if (HAVE_MMX) ff_proresdsp_x86_init(dsp);
00060 
00061     ff_init_scantable_permutation(dsp->idct_permutation,
00062                                   dsp->idct_permutation_type);
00063 }
Generated on Sat Mar 17 2012 12:57:48 for Libav by doxygen 1.7.1