FFmpeg  4.0
mpegvideo_armv5te.c
Go to the documentation of this file.
1 /*
2  * Optimization of some functions from mpegvideo.c for armv5te
3  * Copyright (c) 2007 Siarhei Siamashka <ssvb@users.sourceforge.net>
4  *
5  * This file is part of FFmpeg.
6  *
7  * FFmpeg is free software; you can redistribute it and/or
8  * modify it under the terms of the GNU Lesser General Public
9  * License as published by the Free Software Foundation; either
10  * version 2.1 of the License, or (at your option) any later version.
11  *
12  * FFmpeg is distributed in the hope that it will be useful,
13  * but WITHOUT ANY WARRANTY; without even the implied warranty of
14  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
15  * Lesser General Public License for more details.
16  *
17  * You should have received a copy of the GNU Lesser General Public
18  * License along with FFmpeg; if not, write to the Free Software
19  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
20  */
21 
22 #include "libavutil/attributes.h"
23 #include "libavutil/avassert.h"
24 #include "libavcodec/avcodec.h"
25 #include "libavcodec/mpegvideo.h"
26 #include "mpegvideo_arm.h"
27 
28 void ff_dct_unquantize_h263_armv5te(int16_t *block, int qmul, int qadd, int count);
29 
30 #ifdef ENABLE_ARM_TESTS
31 /**
32  * H.263 dequantizer supplementary function, it is performance critical and needs to
33  * have optimized implementations for each architecture. Is also used as a reference
34  * implementation in regression tests
35  */
36 static inline void dct_unquantize_h263_helper_c(int16_t *block, int qmul, int qadd, int count)
37 {
38  int i, level;
39  for (i = 0; i < count; i++) {
40  level = block[i];
41  if (level) {
42  if (level < 0) {
43  level = level * qmul - qadd;
44  } else {
45  level = level * qmul + qadd;
46  }
47  block[i] = level;
48  }
49  }
50 }
51 #endif
52 
54  int16_t *block, int n, int qscale)
55 {
56  int level, qmul, qadd;
57  int nCoeffs;
58 
59  av_assert2(s->block_last_index[n]>=0);
60 
61  qmul = qscale << 1;
62 
63  if (!s->h263_aic) {
64  if (n < 4)
65  level = block[0] * s->y_dc_scale;
66  else
67  level = block[0] * s->c_dc_scale;
68  qadd = (qscale - 1) | 1;
69  }else{
70  qadd = 0;
71  level = block[0];
72  }
73  if(s->ac_pred)
74  nCoeffs=63;
75  else
76  nCoeffs= s->inter_scantable.raster_end[ s->block_last_index[n] ];
77 
78  ff_dct_unquantize_h263_armv5te(block, qmul, qadd, nCoeffs + 1);
79  block[0] = level;
80 }
81 
83  int16_t *block, int n, int qscale)
84 {
85  int qmul, qadd;
86  int nCoeffs;
87 
88  av_assert2(s->block_last_index[n]>=0);
89 
90  qadd = (qscale - 1) | 1;
91  qmul = qscale << 1;
92 
93  nCoeffs= s->inter_scantable.raster_end[ s->block_last_index[n] ];
94 
95  ff_dct_unquantize_h263_armv5te(block, qmul, qadd, nCoeffs + 1);
96 }
97 
99 {
102 }
const char * s
Definition: avisynth_c.h:768
void(* dct_unquantize_h263_inter)(struct MpegEncContext *s, int16_t *block, int n, int qscale)
Definition: mpegvideo.h:528
static void dct_unquantize_h263_inter_armv5te(MpegEncContext *s, int16_t *block, int n, int qscale)
uint8_t raster_end[64]
Definition: idctdsp.h:34
mpegvideo header.
int h263_aic
Advanced INTRA Coding (AIC)
Definition: mpegvideo.h:87
Macro definitions for various function/variable attributes.
static int16_t block[64]
Definition: dct.c:115
#define av_cold
Definition: attributes.h:82
#define av_assert2(cond)
assert() equivalent, that does lie in speed critical code.
Definition: avassert.h:64
simple assert() macros that are a bit more flexible than ISO C assert().
int block_last_index[12]
last non zero coefficient in block
Definition: mpegvideo.h:86
int n
Definition: avisynth_c.h:684
Libavcodec external API header.
av_cold void ff_mpv_common_init_armv5te(MpegEncContext *s)
void ff_dct_unquantize_h263_armv5te(int16_t *block, int qmul, int qadd, int count)
void(* dct_unquantize_h263_intra)(struct MpegEncContext *s, int16_t *block, int n, int qscale)
Definition: mpegvideo.h:526
static void dct_unquantize_h263_intra_armv5te(MpegEncContext *s, int16_t *block, int n, int qscale)
uint8_t level
Definition: svq3.c:207
MpegEncContext.
Definition: mpegvideo.h:81
void INT64 INT64 count
Definition: avisynth_c.h:690
ScanTable inter_scantable
if inter == intra then intra should be used to reduce the cache usage
Definition: mpegvideo.h:90