TCAX 字幕特效制作工具官方论坛 | ASS | TCAS | Python | Aegisub | Lua

 找回密码
 新人加入
查看: 4209|回复: 3
打印 上一主题 下一主题

[tcaxLib] Parsing TCAS_BUF [复制链接]

Administrator

TCAX Dev.

Rank: 7Rank: 7Rank: 7

跳转到指定楼层
楼主
发表于 2012-3-1 23:10:00 |只看该作者 |倒序浏览
in tcaxPy_Main:

TCAS_BUF = []

temp = []
tcas_main(temp,...)
.....

TCAS_BUF.extend(tcas_parse(temp, width, height, fps))

return (None, TCAS_BUF)



in tcaxPy_User:

you can use TCAS_BUF.extend(), or simply write the parsed buf to file.




the tcas_parse() function receives a TCAS_BUF, with resolution and fps,  and returns a linear TCAS_BUF

Administrator

TCAX Dev.

Rank: 7Rank: 7Rank: 7

沙发
发表于 2012-4-24 22:58:44 |只看该作者

What's in TCAS_BUF

it's a python list, which has the following structure (according to the pseudo-code).
  1.                 pixDip = PyTuple_New(7);
  2.                 PyTuple_SET_ITEM(pixDip, 0, PyLong_FromLong(start));
  3.                 PyTuple_SET_ITEM(pixDip, 1, PyLong_FromLong(end));
  4.                 PyTuple_SET_ITEM(pixDip, 2, PyLong_FromUnsignedLong(layer_type_pair));
  5.                 PyTuple_SET_ITEM(pixDip, 3, PyLong_FromLong(posX));
  6.                 PyTuple_SET_ITEM(pixDip, 4, PyLong_FromLong(posY));
  7.                 PyTuple_SET_ITEM(pixDip, 5, PyLong_FromLong(color));
  8.                 PyTuple_SET_ITEM(pixDip, 6, PyLong_FromLong(alpha));
  9.                 PyList_Append(tcasList, pixDip);
  10.                 Py_CLEAR(pixDip);
复制代码
[(start, end, ltp, posX, posY, color, alpha), ...]

Administrator

TCAX Dev.

Rank: 7Rank: 7Rank: 7

板凳
发表于 2012-4-25 12:32:30 |只看该作者

the process of parsing

1. get the TCAS_BUF as input of tcas_parse, with extra parameters (resolution and fps)
2. use _tcaxlib_convert_tcas_list_to_buf function to create the TCAS_BUF to uncompressed tcas buffer.
3. use libtcas_compress_raw_chunks function to compress the uncompressed tcas buffer to compressed tcas buffer.
4. libtcas_stream_parser_init & libtcas_stream_parser_parse & libtcas_stream_parser_fin functions to parse the compressed tcas buffer and convert to vector of parsed chunks.
5. convert the parsed chunks back to TCAS_BUF

Administrator

TCAX Dev.

Rank: 7Rank: 7Rank: 7

地板
发表于 2012-4-27 16:04:02 |只看该作者
End of the issue, though with some details to handle.
您需要登录后才可以回帖 登录 | 新人加入

GitHub|TCAX 主页

GMT+8, 2024-12-5 02:46

Powered by Discuz! X2

© 2001-2011 Comsenz Inc.

回顶部
RealH