mpu
#include "mpu.h"
#include "mem.h"
#include "my_errno.h"
#include "resampler.h"
#include "media_buffer.h" #define same_ptr (void *) (1)
static mpu_item* same_link(fourcc** ccptr); extern media_process_unit speex_dec_8k16b1_mode8;
extern media_process_unit silk_dec_8k16b1;
extern media_process_unit silk_dec_16k16b1;
extern media_process_unit silk_enc_16k16b1;
extern media_process_unit silk_enc_8k16b1; extern media_process_unit aac_dec_8k16b1;
extern media_process_unit aac_dec_8k16b2;
extern media_process_unit aac_dec_16k16b1;
extern media_process_unit aac_dec_16k16b2;
extern media_process_unit aac_dec_22k16b1;
extern media_process_unit aac_dec_22k16b2;
extern media_process_unit aac_dec_24k16b1;
extern media_process_unit aac_dec_24k16b2;
extern media_process_unit aac_dec_32k16b1;
extern media_process_unit aac_dec_32k16b2;
extern media_process_unit aac_dec_44k16b1;
extern media_process_unit aac_dec_44k16b2;
extern media_process_unit aac_dec_48k16b1;
extern media_process_unit aac_dec_48k16b2; extern media_process_unit aac_enc_8k16b1;
extern media_process_unit aac_enc_8k16b2;
extern media_process_unit aac_enc_16k16b1;
extern media_process_unit aac_enc_16k16b2; extern media_process_unit aacplus_dec_8k16b1;
extern media_process_unit aacplus_dec_8k16b2;
extern media_process_unit aacplus_dec_11k16b1;
extern media_process_unit aacplus_dec_11k16b2;
extern media_process_unit aacplus_dec_16k16b1;
extern media_process_unit aacplus_dec_16k16b2;
extern media_process_unit aacplus_dec_22k16b1;
extern media_process_unit aacplus_dec_22k16b2;
extern media_process_unit aacplus_dec_24k16b1;
extern media_process_unit aacplus_dec_24k16b2; extern media_process_unit opus_dec_8k16b1;
extern media_process_unit opus_dec_16k16b1;
extern media_process_unit opus_dec_24k16b1;
extern media_process_unit opus_dec_24k16b2;
extern media_process_unit opus_dec_32k16b1;
extern media_process_unit opus_dec_32k16b2;
extern media_process_unit opus_dec_48k16b1;
extern media_process_unit opus_dec_48k16b2; extern media_process_unit x264_h264_enc;
extern media_process_unit ffmpeg_h264_dec; #if defined(__ANDROID__)
void probe_omx_h264_dec();
extern media_process_unit omx_h264_dec; void probe_java_h264_enc();
extern media_process_unit java_h264_enc; #elif defined(__APPLE__)
void probe_apple_h264_dec();
extern media_process_unit apple_h264_dec; void probe_apple_h264_enc();
media_process_unit apple_h264_enc;
#endif static media_process_unit* mpu_table[] = {
&ffmpeg_h264_dec,
#if defined(__ANDROID__)
&omx_h264_dec,
&java_h264_enc,
#elif defined(__APPLE__)
&apple_h264_dec,
&apple_h264_enc,
#endif
&x264_h264_enc, &silk_dec_16k16b1,
&silk_dec_8k16b1,
&silk_enc_16k16b1,
&silk_enc_8k16b1, &aac_dec_8k16b1,
&aac_dec_8k16b2,
&aac_dec_16k16b1,
&aac_dec_16k16b2,
&aac_dec_22k16b1,
&aac_dec_22k16b2,
&aac_dec_24k16b1,
&aac_dec_24k16b2,
&aac_dec_32k16b1,
&aac_dec_32k16b2,
&aac_dec_44k16b1,
&aac_dec_44k16b2,
&aac_dec_48k16b1,
&aac_dec_48k16b2, &aac_enc_8k16b1,
&aac_enc_8k16b2,
&aac_enc_16k16b1,
&aac_enc_16k16b2, &aacplus_dec_8k16b1,
&aacplus_dec_8k16b2,
&aacplus_dec_11k16b1,
&aacplus_dec_11k16b2,
&aacplus_dec_16k16b1,
&aacplus_dec_16k16b2,
&aacplus_dec_22k16b1,
&aacplus_dec_22k16b2,
&aacplus_dec_24k16b1,
&aacplus_dec_24k16b2, &opus_dec_8k16b1,
&opus_dec_16k16b1,
&opus_dec_24k16b1,
&opus_dec_24k16b2,
&opus_dec_32k16b1,
&opus_dec_32k16b2,
&opus_dec_48k16b1,
&opus_dec_48k16b2, &speex_dec_8k16b1_mode8,
all_resampler
}; struct dijstra_node {
struct list_head entry;
media_process_unit* unit;
struct dijstra_node* prev;
fourcc** fmt;
uint32_t point;
}; static struct dijstra_node* shortest(struct dijstra_node* from, struct list_head* head, fourcc** left)
{
struct dijstra_node* selected = NULL;
for (struct list_head* ent = head->next; ent != head; ent = ent->next) {
struct dijstra_node* item = list_entry(ent, struct dijstra_node, entry); if (media_same(left, item->unit->infmt)) {
if (from == NULL) {
item->point = item->unit->point;
item->fmt = dynamic_output(left, item->unit->outfmt);
} else {
uint32_t point = from->point + item->unit->point;
if (point < item->point) {
item->fmt = dynamic_output(left, item->unit->outfmt);
item->point = point;
item->prev = from;
}
}
} if (selected == NULL || selected->point > item->point) {
selected = item;
}
} if (selected != NULL) {
list_del(&selected->entry);
}
return selected;
} static void* same_open(fourcc** in, fourcc** out)
{
my_assert(in == out);
return same_ptr;
} static int32_t same_write(void* any, struct my_buffer* mbuf, struct list_head* headp, int32_t* delay)
{
(void) delay;
my_assert(any == same_ptr);
if (__builtin_expect(mbuf == NULL, 0)) {
return 0;
}
list_add_tail(&mbuf->head, headp); int32_t n = 1;
media_buffer* media = (media_buffer *) mbuf->ptr[0];
if (audio_type == media_type(*media->pptr_cc)) {
n = (int32_t) media->vp[0].stride;
}
return n;
} static void same_close(void* any)
{
my_assert(any == same_ptr);
} static void same_unit_init(media_process_unit* unit, fourcc** ccptr)
{
static mpu_operation same_ops = {
same_open,
same_write,
same_close
};
unit->infmt = unit->outfmt = ccptr;
unit->ops = &same_ops;
unit->name = "same";
} static mpu_item* collect_node(struct dijstra_node* last, intptr_t need_same)
{
LIST_HEAD(head); int nr = 0;
struct dijstra_node* cur = last;
while (cur != NULL) {
++nr;
cur = cur->prev;
} if (need_same != 0) {
need_same = sizeof(mpu_item) + sizeof(media_process_unit);
} mpu_item* link = (mpu_item *) my_malloc(sizeof(mpu_item) * nr + need_same);
if (link == NULL) {
errno = ENOMEM;
return NULL;
} if (need_same != 0) {
media_process_unit* unit = (media_process_unit *) (link + nr + 1);
same_unit_init(unit, last->unit->outfmt);
link[nr].unit = unit;
link[nr].handle = NULL;
list_add(&link[nr].entry, &head);
} for (int i = nr - 1; i >= 0; --i) {
list_add(&link[i].entry, &head);
link[i].unit = last->unit;
link[i].handle = NULL;
link[i].infmt = link[i].unit->infmt;
link[i].outfmt = link[i].unit->outfmt;
last = last->prev;
} list_del(&head);
return link;
} mpu_item* alloc_mpu_link(fourcc** in, fourcc** out, intptr_t need_same)
{
if (media_same(in, out)) {
my_assert(need_same != 0);
return same_link(in);
} uint32_t exclude = 0;
if (media_type_raw(in)) {
exclude |= mpu_decoder;
} if (media_type_raw(out)) {
exclude |= mpu_encoder;
} LIST_HEAD(head);
fourcc** cur = in; struct dijstra_node nodes[elements(mpu_table)];
for (int i = 0; i < elements(nodes); ++i) {
INIT_LIST_HEAD(&nodes[i].entry);
nodes[i].unit = mpu_table[i];
if ((nodes[i].unit->role & exclude) ||
(nodes[i].unit->infmt[0]->type != in[0]->type))
{
continue;
} #if defined(__ANDROID__)
if (nodes[i].unit == &omx_h264_dec) {
probe_omx_h264_dec();
} else if (nodes[i].unit == &java_h264_enc) {
probe_java_h264_enc();
}
#elif defined(__APPLE__)
if (nodes[i].unit == &apple_h264_dec) {
probe_apple_h264_dec();
} else if (nodes[i].unit == &apple_h264_enc) {
probe_apple_h264_enc();
}
#endif
if (nodes[i].unit->ops == NULL) {
continue;
}
nodes[i].prev = NULL;
nodes[i].fmt = nodes[i].unit->outfmt;
nodes[i].point = ((uint32_t) -1);
list_add_tail(&nodes[i].entry, &head);
}
struct dijstra_node* pitem = NULL; do {
pitem = shortest(pitem, &head, cur);
if (pitem == NULL) {
break;
} if (media_same(pitem->fmt, out)) {
return collect_node(pitem, need_same);
}
cur = pitem->fmt;
} while (!list_empty(&head) && pitem->point != (uint32_t) (-1)); errno = ESRCH;
return NULL;
} void free_mpu_link(mpu_item* link)
{
my_free(link);
} static mpu_item* same_link(fourcc** ccptr)
{
mpu_item* link = (mpu_item *) my_malloc(sizeof(mpu_item) + sizeof(media_process_unit));
if (link == NULL) {
errno = ENOMEM;
return NULL;
} media_process_unit* unit = (media_process_unit *) (link + 1);
same_unit_init(unit, ccptr);
link->unit = unit;
link->handle = NULL;
INIT_LIST_HEAD(&link->entry);
return link;
}
mpu的更多相关文章
- silk mpu
#include "mpu.h" #include "mbuf.h" #include "media_buffer.h" #include ...
- CPU MPU MCU SOC SOPC关系及区别
在嵌入式开过程,会经常接触到一些缩写术语概念,这些概念在嵌入式行业中使用率非常高,下面我们就解释一下这些概念之间的关系和区别: 1.CPU(Central Processing Unit),是一台计算 ...
- CPU,MPU,MCU,SOC,SOPC联系与差别
转自CPU,MPU,MCU,SOC,SOPC联系与差别 1.CPU(Central Processing Unit),是一台计算机的运算核心和控制核心.CPU由运算器.控制器和寄存器及实现它们之间联系 ...
- MPU和CPU有什么区别?
MPU(或称MP,微处理器)和CPU(中央处理器)同为处理器,但范畴不同. 计算机(即电脑)分为巨型机,大型机,中型机,小型机和微型计算机5类.这5类计算机的运算核心统称为CPU,而MPU只是微型计算 ...
- MMU 和 MPU的区别
S3C2440里面带的是MMU,而现在流行的Cortex-M3/4 里面带的是MPU. MMU vs MPU 内存是现代计算机最重要的组件之一.因此,它的内容不能被任何错误的应用所篡改.这个功能可以通 ...
- 【STM32H7教程】第23章 STM32H7的MPU内存保护单元(重要)
完整教程下载地址:http://forum.armfly.com/forum.php?mod=viewthread&tid=86980 第23章 STM32H7的MPU内存保护单元 ...
- 谈谈IC、ASIC、SoC、MPU、MCU、CPU、GPU、DSP、FPGA、CPLD
IC (integrated circuit) 集成电路:微电路.微芯片.芯片:集成电路又分成:模拟集成电路(线性电路).数字集成电路.数/模混合集成电路: 模拟集成电路:产生.放大.处理各种模拟信号 ...
- 意法半导体STM32MP157A MPU加持,米尔科技首款ST Linux开发板MYD-YA157C评测
ST公司去年推出了MPU系列芯片,MPU系列不同于以往产品,它既包含有ARM公司Cortex M 单片机核心,也包含有ARM公司Cortex A 应用处理器核心,以期将STM32单片机产品优势扩展到更 ...
- 【.NET 与树莓派】六轴飞控传感器(MPU 6050)
所谓"飞控",其实是重力加速度计和陀螺仪的组合,因为多用于控制飞行器的平衡(无人机.遥控飞机).有同学会问,这货为什么会有六轴呢?咱们常见的不是X.Y.Z三轴吗?重力加速度有三轴, ...
随机推荐
- er3
<html xmlns:v="urn:schemas-microsoft-com:vml"xmlns:o="urn:schemas-microsoft-com:of ...
- 自己动手写Logistic回归算法
假设一个数据集有n个样本,每个样本有m个特征,样本标签y为{0, 1}. 数据集可表示为: 其中,x(ij)为第i个样本的第j个特征值,y(i)为第i个样本的标签. X矩阵左侧的1相当于回归方程的常数 ...
- 公钥私钥和RSA算法
1, RSA算法原理(一) http://www.ruanyifeng.com/blog/2013/06/rsa_algorithm_part_one.html 2, RSA算法原理(二) http: ...
- 。i节点
http://blog.csdn.net/feiyinzilgd/article/details/5609157 linux中,文件查找不是通过文件名称来查找的.实际上是通过i节点来实现文件的查找定 ...
- 要慎用mysql的enum字段的原因
背景:时下都流行enum类型的使用tinyint,那enum就真没有用的价值了么? PHP低级编程的兄弟是这样来看这个问题的,我作下笔录如下,期望能客观的理解这个enum字段的优点及缺点: 膘哥观点: ...
- Java开发中经典的小实例-(swich(){case:参数break;default: break;})
import java.util.Scanner;public class Test6 { public static void main(String[] args) { // ...
- codeforces 748E Santa Claus and Tangerines
E. Santa Claus and Tangerines time limit per test 2 seconds memory limit per test 256 megabytes inpu ...
- PL/SQL通过免安装客户端连接远端ORACLE数据库
参考百度经验:http://jingyan.baidu.com/article/375c8e19b4094d25f2a2291a.html
- An error occurred while collecting items to be installed
安装的插件:Activiti 在Eclipse安装插件时,报以下错误: An error occurred while collecting items to be installed session ...
- ajax提交表单+前端验证小示例
<script src="http://css.jj.cn/js/jquery.js" type="text/javascript"></sc ...