脚后筋疼是什么原因引起的| 穿云箭是什么意思| 凤毛麟角是什么生肖| 阴茎插入阴道什么感觉| 大肠杆菌感染吃什么药| 钓是什么意思| 黄片是什么| 食禄痣是什么意思| 子宫发炎是什么原因引起的| 除了火车什么车最长| 晋升是什么意思| helen是什么意思| 89年蛇是什么命| 血色素低是什么原因| 为什么小孩子经常流鼻血| 因为我们没有什么不同| 万条垂下绿丝绦的上一句是什么| 情绪是什么| 爱做梦是什么原因| 不显怀的人有什么特点| 钺读什么| 影像是什么意思| 桂鱼吃什么食物| 置之不理的置是什么意思| 判处死刑缓期二年执行是什么意思| 儿童吃手指是什么原因| 喝什么助眠| 古人的婚礼在什么时间举行| 排卵日是什么意思| 丁未五行属什么| 牙疼吃什么好得快| 精神小伙什么意思| 1.12是什么星座| 对称是什么意思| 什么男什么女| 铁蛋白是什么意思| 三尖瓣反流什么意思| 过氧化氢一个加号什么意思| 骨折喝酒有什么影响吗| 右眼皮跳是什么预兆| 月经推迟一个月不来什么原因| 烫伤擦什么药膏| 98年的虎是什么命| 四个雷念什么| 本来无一物何处惹尘埃什么意思| 为什么会梦见前男友| 爱啃指甲是什么原因| 大便每天四五次是什么病| 头晕呕吐吃什么药| 身怀六甲是什么意思| 欲言又止什么意思| 胃病可以吃什么水果| 酒后头疼吃什么| 补肾壮阳吃什么药好| 意会是什么意思| 国家电网是什么单位| 乔迁送什么水果| 175是什么码| 付诸东流是什么意思| 指甲分层是什么原因| 消化不好吃什么| 回奶吃什么快最有效的| 周杰伦什么星座| 前列腺增大是什么意思| 孕妇肠胃炎能吃什么药| review是什么意思| 打升白针有什么副作用| 千秋无绝色悦目是佳人什么意思| 什么嘴什么舌| 打喷嚏鼻塞吃什么药| 睡眠不好总做梦是什么原因| 油条吃多了有什么危害| 1885年属什么生肖| 什么动物吃猫| 尿常规白细胞3个加号什么意思| 刘伯温属什么生肖| 多喝白开水有什么好处| 高血脂吃什么| 失眠睡不着吃什么药好| 舌苔发白是什么病的前兆| 爆栗什么意思| 小圆细胞阳性什么意思| 星星像什么| 农村一般喂金毛吃什么| 胳膊疼痛是什么原因| 绚丽夺目的意思是什么| 反法西斯是什么意思| 煲电话粥什么意思| 穆字五行属什么| 孩子脾胃虚弱吃什么药| 甘油三酯高吃什么药能降下来| 散射光是什么意思| 胸腔积液是什么意思| 高处不胜寒是什么意思| 中国最长的河流是什么| 指甲断裂是什么原因| 呼吸不过来要喘大气是什么情况| 阴虚火旺吃什么调理| 右眼睛总跳是什么原因| 什么是领导| 粘膜充血水肿什么意思| 经常熬夜吃什么好| 长期吃优甲乐有什么副作用| 牛蒡茶有什么功效| 经常恶心干呕是什么原因| 晕车喝什么饮料| 肝肾阴虚吃什么药| 油为什么会浮在水面上| 狗脊是什么东西| jk制服是什么意思| 为什么北极没有企鹅| 牙齿经常出血是什么原因| modern是什么牌子| 经血是什么血| 莘莘学子什么意思| 尿道炎症吃什么药好| 什么是超声波| 痔疮手术后可以吃什么水果| 梦见吃酒席是什么意思| 烧心是什么原因| 火麻是什么植物| 主家是什么意思| 小孩子长白头发是什么原因| 复方木尼孜其颗粒治什么病| 怀孕7天有什么症状| 子宫直肠陷凹什么意思| 诸葛亮为什么气死周瑜| 伤口撒什么药粉好得快| 为什么会气血不足| 一个兹一个子念什么| 坐骨神经有什么症状| 人日是什么意思| 唇炎去药店买什么药| 肚子痛看什么科| 梦见前男友死了是什么意思| 梗米是什么| 艾滋病潜伏期有什么症状| 公安局属于什么机关| 鸽子公主是什么意思| 流量加油包是什么意思| 韩束属于什么档次| 615是什么星座| 什么是肺气肿| 开胸手术吃什么补元气| 大姨妈期间可以吃什么水果| 水母吃什么食物| 什么是氙气| 亲子鉴定需要什么样本| pbg是什么意思| 骨折后吃什么食物促进骨头愈合| 安慰是什么意思| 女性脱发严重是什么原因引起的| 婴儿42天检查什么项目| 常务理事是什么职位| 风热感冒吃什么药最好| 淼念什么| 秀才指什么生肖| 什么是甲减病| ct是什么| smz是什么药| 睡觉打鼾是什么原因| 什么饮料解渴| 头皮发痒用什么洗发水| dx是什么意思| 药食同源是什么意思| 王姓为什么出不了皇帝| 低钾有什么症状和危害| 梦见小孩是什么| 舌苔白腻是什么原因| 牛肉和什么菜包饺子好吃| 平舌音是什么| 虐狗什么意思| 湖南有什么景点| ppi是什么药| 父亲b型血母亲o型血孩子什么血型| 怀孕10多天有什么症状| 脆肉鲩是什么鱼| 中耳炎吃什么药最有效| 马斯卡彭是什么| 梅花鹿吃什么食物| 当医生需要什么条件| 后脑勺麻木是什么征兆| 乳头痛是什么原因| 腹腔积液是什么原因| 口苦尿黄是什么原因| 孕妇快生的时候有什么征兆| 尿道口痛什么原因| 浪子回头金不换是什么意思| 北京为什么是首都| 什么是血氧| 房颤什么症状| 体检挂什么科室| 失心疯是什么意思| 阴疽是什么病| 乞丐是什么生肖| 胆汁淤积吃什么药| 什么是脑瘫| 什么是正月| 洪字五行属什么| 略是什么意思| 单核细胞是什么| 什么菜炒肉好吃| 看舌头应该挂什么科| 红茶用什么茶具泡好| 什么非常什么| 腹胀挂什么科| 上午十点到十一点是什么时辰| 拉肚子可以吃什么食物| 吃什么补肺养肺比较好| 做头发是什么意思| 触感是什么意思| 宫颈炎是什么| 想吃肉是身体缺什么| 感冒是什么原因引起的| 心脏疼是什么原因| 脾胃虚吃什么好| 一幅什么| 花木兰属什么生肖| 为什么会得水痘| 血压低会出现什么症状| 斩衰是什么意思| 每天吃什么菜谱星期表| fdg代谢增高是什么意思| 花肠是母猪的什么部位| 17592a是什么尺码男装| 围度什么意思| 伤疤好了变黑了是什么原因| 范思哲是什么品牌| 这个表情什么意思| 吃益生菌有什么好处| 心脏传导阻滞吃什么药| 不疑有他什么意思| 曼波是什么意思| 木字旁的字有什么| pe医学上是什么意思| 磨砂膏有什么作用| 九月七日是什么星座| 沉香木是什么| 钼靶检查是什么意思| 如来藏是什么意思| 紧急避孕药吃了有什么副作用| 男性生殖器叫什么| 脑供血不足吃什么药效果最好| 撒贝宁是什么民族| 空调一级能效什么意思| 深圳属于什么方向| wi-fi是什么意思| 祛是什么意思| 肚子胀气吃什么药| 尿妊娠试验是检查什么| 今天是什么甲子| 被孤立的一般是什么人| 一花一世界下一句是什么| 宝宝便秘吃什么| 唾液分泌过多是什么原因| 肚子下面是什么部位| 苯是什么味道| 西米是用什么做的| 铺天盖地的意思是什么| 父母都是a型血孩子是什么血型| 柳暗花明是什么生肖| 金钱龟吃什么食物| 降真香是什么| 睡觉时头晕是什么原因| 百度

【仲裁视点】二手车未更名,发生剐蹭谁担责?


Directory: ../../../ffmpeg/
File: src/libavcodec/g722enc.c
Date: 2025-08-04 00:43:16
Exec Total Coverage
Lines: 69 157 43.9%
Functions: 8 9 88.9%
Branches: 24 110 21.8%

Line Branch Exec Source
1 /*
2 * Copyright (c) CMU 1993 Computer Science, Speech Group
3 * Chengxiang Lu and Alex Hauptmann
4 * Copyright (c) 2005 Steve Underwood <steveu at coppice.org>
5 * Copyright (c) 2009 Kenan Gillet
6 * Copyright (c) 2010 Martin Storsjo
7 *
8 * This file is part of FFmpeg.
9 *
10 * FFmpeg is free software; you can redistribute it and/or
11 * modify it under the terms of the GNU Lesser General Public
12 * License as published by the Free Software Foundation; either
13 * version 2.1 of the License, or (at your option) any later version.
14 *
15 * FFmpeg is distributed in the hope that it will be useful,
16 * but WITHOUT ANY WARRANTY; without even the implied warranty of
17 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
18 * Lesser General Public License for more details.
19 *
20 * You should have received a copy of the GNU Lesser General Public
21 * License along with FFmpeg; if not, write to the Free Software
22 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
23 */
24
25 /**
26 * @file
27 * G.722 ADPCM audio encoder
28 */
29
30 #include "libavutil/avassert.h"
31 #include "libavutil/channel_layout.h"
32 #include "libavutil/mem.h"
33 #include "avcodec.h"
34 #include "codec_internal.h"
35 #include "encode.h"
36 #include "g722.h"
37 #include "libavutil/common.h"
38
39 #define FREEZE_INTERVAL 128
40
41 /* This is an arbitrary value. Allowing insanely large values leads to strange
42 problems, so we limit it to a reasonable value */
43 #define MAX_FRAME_SIZE 32768
44
45 /* We clip the value of avctx->trellis to prevent data type overflows and
46 undefined behavior. Using larger values is insanely slow anyway. */
47 #define MIN_TRELLIS 0
48 #define MAX_TRELLIS 16
49
50 1 static av_cold int g722_encode_close(AVCodecContext *avctx)
51 {
52 1 G722Context *c = avctx->priv_data;
53 int i;
54
2/2
✓ Branch 0 taken 2 times.
✓ Branch 1 taken 1 times.
3 for (i = 0; i < 2; i++) {
55 2 av_freep(&c->paths[i]);
56 2 av_freep(&c->node_buf[i]);
57 2 av_freep(&c->nodep_buf[i]);
58 }
59 1 return 0;
60 }
61
62 1 static av_cold int g722_encode_init(AVCodecContext * avctx)
63 {
64 1 G722Context *c = avctx->priv_data;
65
66 1 c->band[0].scale_factor = 8;
67 1 c->band[1].scale_factor = 2;
68 1 c->prev_samples_pos = 22;
69
70
1/2
✗ Branch 0 not taken.
✓ Branch 1 taken 1 times.
1 if (avctx->frame_size) {
71 /* validate frame size */
72 if (avctx->frame_size & 1 || avctx->frame_size > MAX_FRAME_SIZE) {
73 int new_frame_size;
74
75 if (avctx->frame_size == 1)
76 new_frame_size = 2;
77 else if (avctx->frame_size > MAX_FRAME_SIZE)
78 new_frame_size = MAX_FRAME_SIZE;
79 else
80 new_frame_size = avctx->frame_size - 1;
81
82 av_log(avctx, AV_LOG_WARNING, "Requested frame size is not "
83 "allowed. Using %d instead of %d\n", new_frame_size,
84 avctx->frame_size);
85 avctx->frame_size = new_frame_size;
86 }
87 } else {
88 /* This is arbitrary. We use 320 because it's 20ms @ 16kHz, which is
89 a common packet size for VoIP applications */
90 1 avctx->frame_size = 320;
91 }
92 1 avctx->initial_padding = 22;
93
94
1/2
✗ Branch 0 not taken.
✓ Branch 1 taken 1 times.
1 if (avctx->trellis) {
95 /* validate trellis */
96 if (avctx->trellis < MIN_TRELLIS || avctx->trellis > MAX_TRELLIS) {
97 int new_trellis = av_clip(avctx->trellis, MIN_TRELLIS, MAX_TRELLIS);
98 av_log(avctx, AV_LOG_WARNING, "Requested trellis value is not "
99 "allowed. Using %d instead of %d\n", new_trellis,
100 avctx->trellis);
101 avctx->trellis = new_trellis;
102 }
103 if (avctx->trellis) {
104 int frontier = 1 << avctx->trellis;
105 int max_paths = frontier * FREEZE_INTERVAL;
106
107 for (int i = 0; i < 2; i++) {
108 c->paths[i] = av_calloc(max_paths, sizeof(**c->paths));
109 c->node_buf[i] = av_calloc(frontier, 2 * sizeof(**c->node_buf));
110 c->nodep_buf[i] = av_calloc(frontier, 2 * sizeof(**c->nodep_buf));
111 if (!c->paths[i] || !c->node_buf[i] || !c->nodep_buf[i])
112 return AVERROR(ENOMEM);
113 }
114 }
115 }
116
117 1 ff_g722dsp_init(&c->dsp);
118
119 1 return 0;
120 }
121
122 static const int16_t low_quant[33] = {
123 35, 72, 110, 150, 190, 233, 276, 323,
124 370, 422, 473, 530, 587, 650, 714, 786,
125 858, 940, 1023, 1121, 1219, 1339, 1458, 1612,
126 1765, 1980, 2195, 2557, 2919
127 };
128
129 48000 static inline void filter_samples(G722Context *c, const int16_t *samples,
130 int *xlow, int *xhigh)
131 {
132 int xout[2];
133 48000 c->prev_samples[c->prev_samples_pos++] = samples[0];
134 48000 c->prev_samples[c->prev_samples_pos++] = samples[1];
135 48000 c->dsp.apply_qmf(c->prev_samples + c->prev_samples_pos - 24, xout);
136 48000 *xlow = xout[0] + xout[1] >> 14;
137 48000 *xhigh = xout[0] - xout[1] >> 14;
138
2/2
✓ Branch 0 taken 95 times.
✓ Branch 1 taken 47905 times.
48000 if (c->prev_samples_pos >= PREV_SAMPLES_BUF_SIZE) {
139 95 memmove(c->prev_samples,
140 95 c->prev_samples + c->prev_samples_pos - 22,
141 22 * sizeof(c->prev_samples[0]));
142 95 c->prev_samples_pos = 22;
143 }
144 48000 }
145
146 48000 static inline int encode_high(const struct G722Band *state, int xhigh)
147 {
148 48000 int diff = av_clip_int16(xhigh - state->s_predictor);
149 48000 int pred = 141 * state->scale_factor >> 8;
150 /* = diff >= 0 ? (diff < pred) + 2 : diff >= -pred */
151
2/2
✓ Branch 0 taken 36243 times.
✓ Branch 1 taken 11757 times.
48000 return ((diff ^ (diff >> (sizeof(diff)*8-1))) < pred) + 2*(diff >= 0);
152 }
153
154 48000 static inline int encode_low(const struct G722Band* state, int xlow)
155 {
156 48000 int diff = av_clip_int16(xlow - state->s_predictor);
157 /* = diff >= 0 ? diff : -(diff + 1) */
158 48000 int limit = diff ^ (diff >> (sizeof(diff)*8-1));
159 48000 int i = 0;
160 48000 limit = limit + 1 << 10;
161
2/2
✓ Branch 0 taken 21162 times.
✓ Branch 1 taken 26838 times.
48000 if (limit > low_quant[8] * state->scale_factor)
162 21162 i = 9;
163
4/4
✓ Branch 0 taken 265901 times.
✓ Branch 1 taken 373 times.
✓ Branch 2 taken 218274 times.
✓ Branch 3 taken 47627 times.
266274 while (i < 29 && limit > low_quant[i] * state->scale_factor)
164 218274 i++;
165
4/4
✓ Branch 0 taken 21318 times.
✓ Branch 1 taken 26682 times.
✓ Branch 2 taken 2349 times.
✓ Branch 3 taken 18969 times.
48000 return (diff < 0 ? (i < 2 ? 63 : 33) : 61) - i;
166 }
167
168 static void g722_encode_trellis(G722Context *c, int trellis,
169 uint8_t *dst, int nb_samples,
170 const int16_t *samples)
171 {
172 int i, j, k;
173 int frontier = 1 << trellis;
174 struct TrellisNode **nodes[2];
175 struct TrellisNode **nodes_next[2];
176 int pathn[2] = {0, 0}, froze = -1;
177 struct TrellisPath *p[2];
178
179 for (i = 0; i < 2; i++) {
180 nodes[i] = c->nodep_buf[i];
181 nodes_next[i] = c->nodep_buf[i] + frontier;
182 memset(c->nodep_buf[i], 0, 2 * frontier * sizeof(*c->nodep_buf[i]));
183 nodes[i][0] = c->node_buf[i] + frontier;
184 nodes[i][0]->ssd = 0;
185 nodes[i][0]->path = 0;
186 nodes[i][0]->state = c->band[i];
187 }
188
189 for (i = 0; i < nb_samples >> 1; i++) {
190 int xlow, xhigh;
191 struct TrellisNode *next[2];
192 int heap_pos[2] = {0, 0};
193
194 for (j = 0; j < 2; j++) {
195 next[j] = c->node_buf[j] + frontier*(i & 1);
196 memset(nodes_next[j], 0, frontier * sizeof(**nodes_next));
197 }
198
199 filter_samples(c, &samples[2*i], &xlow, &xhigh);
200
201 for (j = 0; j < frontier && nodes[0][j]; j++) {
202 /* Only k >> 2 affects the future adaptive state, therefore testing
203 * small steps that don't change k >> 2 is useless, the original
204 * value from encode_low is better than them. Since we step k
205 * in steps of 4, make sure range is a multiple of 4, so that
206 * we don't miss the original value from encode_low. */
207 int range = j < frontier/2 ? 4 : 0;
208 struct TrellisNode *cur_node = nodes[0][j];
209
210 int ilow = encode_low(&cur_node->state, xlow);
211
212 for (k = ilow - range; k <= ilow + range && k <= 63; k += 4) {
213 int decoded, dec_diff, pos;
214 uint32_t ssd;
215 struct TrellisNode* node;
216
217 if (k < 0)
218 continue;
219
220 decoded = av_clip_intp2((cur_node->state.scale_factor *
221 ff_g722_low_inv_quant6[k] >> 10)
222 + cur_node->state.s_predictor, 14);
223 dec_diff = xlow - decoded;
224
225 #define STORE_NODE(index, UPDATE, VALUE)\
226 ssd = cur_node->ssd + dec_diff*dec_diff;\
227 /* Check for wraparound. Using 64 bit ssd counters would \
228 * be simpler, but is slower on x86 32 bit. */\
229 if (ssd < cur_node->ssd)\
230 continue;\
231 if (heap_pos[index] < frontier) {\
232 pos = heap_pos[index]++;\
233 av_assert2(pathn[index] < FREEZE_INTERVAL * frontier);\
234 node = nodes_next[index][pos] = next[index]++;\
235 node->path = pathn[index]++;\
236 } else {\
237 /* Try to replace one of the leaf nodes with the new \
238 * one, but not always testing the same leaf position */\
239 pos = (frontier>>1) + (heap_pos[index] & ((frontier>>1) - 1));\
240 if (ssd >= nodes_next[index][pos]->ssd)\
241 continue;\
242 heap_pos[index]++;\
243 node = nodes_next[index][pos];\
244 }\
245 node->ssd = ssd;\
246 node->state = cur_node->state;\
247 UPDATE;\
248 c->paths[index][node->path].value = VALUE;\
249 c->paths[index][node->path].prev = cur_node->path;\
250 /* Sift the newly inserted node up in the heap to restore \
251 * the heap property */\
252 while (pos > 0) {\
253 int parent = (pos - 1) >> 1;\
254 if (nodes_next[index][parent]->ssd <= ssd)\
255 break;\
256 FFSWAP(struct TrellisNode*, nodes_next[index][parent],\
257 nodes_next[index][pos]);\
258 pos = parent;\
259 }
260 STORE_NODE(0, ff_g722_update_low_predictor(&node->state, k >> 2), k);
261 }
262 }
263
264 for (j = 0; j < frontier && nodes[1][j]; j++) {
265 int ihigh;
266 struct TrellisNode *cur_node = nodes[1][j];
267
268 /* We don't try to get any initial guess for ihigh via
269 * encode_high - since there's only 4 possible values, test
270 * them all. Testing all of these gives a much, much larger
271 * gain than testing a larger range around ilow. */
272 for (ihigh = 0; ihigh < 4; ihigh++) {
273 int dhigh, decoded, dec_diff, pos;
274 uint32_t ssd;
275 struct TrellisNode* node;
276
277 dhigh = cur_node->state.scale_factor *
278 ff_g722_high_inv_quant[ihigh] >> 10;
279 decoded = av_clip_intp2(dhigh + cur_node->state.s_predictor, 14);
280 dec_diff = xhigh - decoded;
281
282 STORE_NODE(1, ff_g722_update_high_predictor(&node->state, dhigh, ihigh), ihigh);
283 }
284 }
285
286 for (j = 0; j < 2; j++) {
287 FFSWAP(struct TrellisNode**, nodes[j], nodes_next[j]);
288
289 if (nodes[j][0]->ssd > (1 << 16)) {
290 for (k = 1; k < frontier && nodes[j][k]; k++)
291 nodes[j][k]->ssd -= nodes[j][0]->ssd;
292 nodes[j][0]->ssd = 0;
293 }
294 }
295
296 if (i == froze + FREEZE_INTERVAL) {
297 p[0] = &c->paths[0][nodes[0][0]->path];
298 p[1] = &c->paths[1][nodes[1][0]->path];
299 for (j = i; j > froze; j--) {
300 dst[j] = p[1]->value << 6 | p[0]->value;
301 p[0] = &c->paths[0][p[0]->prev];
302 p[1] = &c->paths[1][p[1]->prev];
303 }
304 froze = i;
305 pathn[0] = pathn[1] = 0;
306 memset(nodes[0] + 1, 0, (frontier - 1)*sizeof(**nodes));
307 memset(nodes[1] + 1, 0, (frontier - 1)*sizeof(**nodes));
308 }
309 }
310
311 p[0] = &c->paths[0][nodes[0][0]->path];
312 p[1] = &c->paths[1][nodes[1][0]->path];
313 for (j = i; j > froze; j--) {
314 dst[j] = p[1]->value << 6 | p[0]->value;
315 p[0] = &c->paths[0][p[0]->prev];
316 p[1] = &c->paths[1][p[1]->prev];
317 }
318 c->band[0] = nodes[0][0]->state;
319 c->band[1] = nodes[1][0]->state;
320 }
321
322 48000 static av_always_inline void encode_byte(G722Context *c, uint8_t *dst,
323 const int16_t *samples)
324 {
325 int xlow, xhigh, ilow, ihigh;
326 48000 filter_samples(c, samples, &xlow, &xhigh);
327 48000 ihigh = encode_high(&c->band[1], xhigh);
328 48000 ilow = encode_low (&c->band[0], xlow);
329 48000 ff_g722_update_high_predictor(&c->band[1], c->band[1].scale_factor *
330 48000 ff_g722_high_inv_quant[ihigh] >> 10, ihigh);
331 48000 ff_g722_update_low_predictor(&c->band[0], ilow >> 2);
332 48000 *dst = ihigh << 6 | ilow;
333 48000 }
334
335 300 static void g722_encode_no_trellis(G722Context *c,
336 uint8_t *dst, int nb_samples,
337 const int16_t *samples)
338 {
339 int i;
340
2/2
✓ Branch 0 taken 48000 times.
✓ Branch 1 taken 300 times.
48300 for (i = 0; i < nb_samples; i += 2)
341 48000 encode_byte(c, dst++, &samples[i]);
342 300 }
343
344 300 static int g722_encode_frame(AVCodecContext *avctx, AVPacket *avpkt,
345 const AVFrame *frame, int *got_packet_ptr)
346 {
347 300 G722Context *c = avctx->priv_data;
348 300 const int16_t *samples = (const int16_t *)frame->data[0];
349 int nb_samples, out_size, ret;
350
351 300 out_size = (frame->nb_samples + 1) / 2;
352
1/2
✗ Branch 1 not taken.
✓ Branch 2 taken 300 times.
300 if ((ret = ff_get_encode_buffer(avctx, avpkt, out_size, 0)) < 0)
353 return ret;
354
355 300 nb_samples = frame->nb_samples - (frame->nb_samples & 1);
356
357
1/2
✗ Branch 0 not taken.
✓ Branch 1 taken 300 times.
300 if (avctx->trellis)
358 g722_encode_trellis(c, avctx->trellis, avpkt->data, nb_samples, samples);
359 else
360 300 g722_encode_no_trellis(c, avpkt->data, nb_samples, samples);
361
362 /* handle last frame with odd frame_size */
363
1/2
✗ Branch 0 not taken.
✓ Branch 1 taken 300 times.
300 if (nb_samples < frame->nb_samples) {
364 int16_t last_samples[2] = { samples[nb_samples], samples[nb_samples] };
365 encode_byte(c, &avpkt->data[nb_samples >> 1], last_samples);
366 }
367
368
1/2
✓ Branch 0 taken 300 times.
✗ Branch 1 not taken.
300 if (frame->pts != AV_NOPTS_VALUE)
369 300 avpkt->pts = frame->pts - ff_samples_to_time_base(avctx, avctx->initial_padding);
370 300 *got_packet_ptr = 1;
371 300 return 0;
372 }
373
374 const FFCodec ff_adpcm_g722_encoder = {
375 .p.name = "g722",
376 CODEC_LONG_NAME("G.722 ADPCM"),
377 .p.type = AVMEDIA_TYPE_AUDIO,
378 .p.id = AV_CODEC_ID_ADPCM_G722,
379 .p.capabilities = AV_CODEC_CAP_DR1 | AV_CODEC_CAP_SMALL_LAST_FRAME |
380 AV_CODEC_CAP_ENCODER_REORDERED_OPAQUE,
381 .priv_data_size = sizeof(G722Context),
382 .init = g722_encode_init,
383 .close = g722_encode_close,
384 FF_CODEC_ENCODE_CB(g722_encode_frame),
385 CODEC_SAMPLEFMTS(AV_SAMPLE_FMT_S16),
386 CODEC_CH_LAYOUTS(AV_CHANNEL_LAYOUT_MONO),
387 .caps_internal = FF_CODEC_CAP_INIT_CLEANUP,
388 };
389

肩周炎是什么引起的 水飞蓟是什么 1943年属什么生肖 艾灰有什么作用和功效 沙弗莱是什么宝石
大腿根部痛是什么原因 丝瓜不能和什么食物一起吃 摄政王是什么意思 三月一日是什么星座 菏泽有什么好玩的地方
紫罗兰色是什么颜色 美人鱼是什么动物 下面痒是什么原因 表姐的孩子叫我什么 冷冻跟冷藏有什么区别
弱不禁风是什么生肖 顺势而为什么意思 pigeon是什么牌子 刘璋和刘备什么关系 吃饭不规律会导致什么问题
外面下着雨犹如我心血在滴什么歌hcv8jop6ns5r.cn 痞块是什么意思hcv9jop1ns7r.cn 安宫丸什么时候吃效果是最佳的hcv8jop5ns4r.cn 炸薯条用什么淀粉hcv8jop7ns5r.cn 处cp是什么意思hcv9jop0ns7r.cn
什么叫钙化xscnpatent.com 胃恶心想吐吃什么药hcv7jop9ns4r.cn 血压表什么牌子的好最准确最耐用hcv8jop4ns4r.cn 矿物质是什么hcv9jop3ns9r.cn 什么是童子命hcv8jop5ns0r.cn
喉咙痛吃什么药效果最好hcv9jop3ns0r.cn 中国梦是什么hcv9jop7ns5r.cn 中秋节有什么活动hcv7jop6ns2r.cn 立冬是什么意思hcv8jop8ns1r.cn 女人三十如狼四十如虎什么意思hcv7jop7ns1r.cn
马马虎虎指什么生肖hcv9jop0ns5r.cn 土命和什么命最配hcv9jop3ns8r.cn 脚腕肿是什么原因hcv8jop7ns7r.cn 泌尿科属于什么科bfb118.com 立是什么意思jingluanji.com
百度