Libav 0.7.1
|
00001 /* 00002 * Optimization of some functions from mpegvideo.c for armv5te 00003 * Copyright (c) 2007 Siarhei Siamashka <ssvb@users.sourceforge.net> 00004 * 00005 * This file is part of Libav. 00006 * 00007 * Libav is free software; you can redistribute it and/or 00008 * modify it under the terms of the GNU Lesser General Public 00009 * License as published by the Free Software Foundation; either 00010 * version 2.1 of the License, or (at your option) any later version. 00011 * 00012 * Libav is distributed in the hope that it will be useful, 00013 * but WITHOUT ANY WARRANTY; without even the implied warranty of 00014 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 00015 * Lesser General Public License for more details. 00016 * 00017 * You should have received a copy of the GNU Lesser General Public 00018 * License along with Libav; if not, write to the Free Software 00019 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA 00020 */ 00021 00022 #include "libavcodec/avcodec.h" 00023 #include "libavcodec/dsputil.h" 00024 #include "libavcodec/mpegvideo.h" 00025 #include "mpegvideo_arm.h" 00026 00027 void ff_dct_unquantize_h263_armv5te(DCTELEM *block, int qmul, int qadd, int count); 00028 00029 #ifdef ENABLE_ARM_TESTS 00030 00035 static inline void dct_unquantize_h263_helper_c(DCTELEM *block, int qmul, int qadd, int count) 00036 { 00037 int i, level; 00038 for (i = 0; i < count; i++) { 00039 level = block[i]; 00040 if (level) { 00041 if (level < 0) { 00042 level = level * qmul - qadd; 00043 } else { 00044 level = level * qmul + qadd; 00045 } 00046 block[i] = level; 00047 } 00048 } 00049 } 00050 #endif 00051 00052 static void dct_unquantize_h263_intra_armv5te(MpegEncContext *s, 00053 DCTELEM *block, int n, int qscale) 00054 { 00055 int level, qmul, qadd; 00056 int nCoeffs; 00057 00058 assert(s->block_last_index[n]>=0); 00059 00060 qmul = qscale << 1; 00061 00062 if (!s->h263_aic) { 00063 if (n < 4) 00064 level = block[0] * s->y_dc_scale; 00065 else 00066 level = block[0] * s->c_dc_scale; 00067 qadd = (qscale - 1) | 1; 00068 }else{ 00069 qadd = 0; 00070 level = block[0]; 00071 } 00072 if(s->ac_pred) 00073 nCoeffs=63; 00074 else 00075 nCoeffs= s->inter_scantable.raster_end[ s->block_last_index[n] ]; 00076 00077 ff_dct_unquantize_h263_armv5te(block, qmul, qadd, nCoeffs + 1); 00078 block[0] = level; 00079 } 00080 00081 static void dct_unquantize_h263_inter_armv5te(MpegEncContext *s, 00082 DCTELEM *block, int n, int qscale) 00083 { 00084 int qmul, qadd; 00085 int nCoeffs; 00086 00087 assert(s->block_last_index[n]>=0); 00088 00089 qadd = (qscale - 1) | 1; 00090 qmul = qscale << 1; 00091 00092 nCoeffs= s->inter_scantable.raster_end[ s->block_last_index[n] ]; 00093 00094 ff_dct_unquantize_h263_armv5te(block, qmul, qadd, nCoeffs + 1); 00095 } 00096 00097 void MPV_common_init_armv5te(MpegEncContext *s) 00098 { 00099 s->dct_unquantize_h263_intra = dct_unquantize_h263_intra_armv5te; 00100 s->dct_unquantize_h263_inter = dct_unquantize_h263_inter_armv5te; 00101 }