decoding_encoding
- 格式:docx
- 大小:18.70 KB
- 文档页数:10
Cultural and Religious Studies, May 2023, Vol. 11, No. 5, 241-245doi: 10.17265/2328-2177/2023.05.005 The Dissemination of Intangible Cultural Heritage AlongBeijing-Hangzhou Canal Based on Encoding/Decoding Theory *TAN Hao, XIANYU JingBeijing Union University, Beijing, ChinaThe Beijing-Hangzhou Grand Canal carries a wealth of Chinese cultural symbols, showing the lifestyle and wisdomof working people through ages. The preservation and inheritance of its intangible cultural heritage can help to evokecultural memories and cultural identification of the Canal and build cultural confidence. This paper applies StuartHall’s encoding/decoding theory to analyze the dissemination of intangible heritage tourism culture. On the basis ofa practical study of the villages along the Beijing-Hangzhou Grand Canal, this paper analyses the problems in thetransmission of its intangible cultural heritage and proposes specific methods to solve them in four processes,encoding, decoding, communication, and secondary encoding, in order to propose references for the transmission ofintangible heritage culture at home and abroad.Keywords: dissemination, encoding, decoding, intangible cultural heritageIntroductionThe Beijing-Hangzhou Grand Canal was built during the Spring and Autumn Period, and it has a history of more than 2,500 years. With a total length of about 1,797 kilometers, it is a historical treasure that is closely related to the lifestyle of working people and traditional Chinese culture, including traditional music, traditional dance, traditional painting, traditional skills, etc. For many reasons, the Canal’s intangible cultural heritage (ICH) has not yet been effectively inherited and disseminated, and it is also in danger of being lost. Stuart Ha ll’s encoding/decoding theory model is able to break away from the shackles of subject-object linear transmission of culture communication, and view the process of ICH transmission from the perspective of encoding-communication-decoding. The study of the ICH tourism culture circulation through encoding and decoding theory has both practical and historical significance.Method for StudyStuart Hall argues that discourse is like a commodity that goes through the four stages of production, circulation, consumption, and reproduction described by Marxism (Chen & Lin, 2014), and suggests that individuals may resist or negotiate on the dissemination of an ideology (Evan, 2015). China is rich in ICH, but if it is not disseminated, the preservation of heritage would become completely impotent. As Foucault put it, “criticism” is one of the circulation mechanisms for knowledge to release its power (Claudia & Donna, 2021). * This paper is supported by the National Social Science Fund Project (No. 20BH151).TAN Hao, post-graduate student, College of Applied Science and Technology of Beijing Union University, Beijing, China. XIANYU Jing (corresponding author), Ph.D., Associate Professor, Tourism College of Beijing Union University, Beijing, China.DA VID PUBLISHINGDTHE DISSEMINATION OF INTANGIBLE CULTURAL HERITAGE242Wu (2007) points out that cultural communication is both a social phenomenon and a fundamental part of tourism destination marketing, and the transmission of information is also an important form of tourism service.The transmission of ICH tourism culture goes through three stages: encoding, communication, and decoding. The encoding process refers to the production of ICH tourism products, which emphasizes modern artistic processing while preserving the authenticity of ICH and presenting in a way that is pleasing to the audience. The Grand Canal ICH is not only an indispensable part of canal cultural heritage, but also a potential tourism resource for tourist destination development (Zhang, 2020). The communication process of ICH is to disseminate the encoded ICH information to the audience via various forms. In this process, the discourse of ICH is not a closed system, but consists of topics, treatments, issues, and events (Zou, 2014). The decoding process of ICH means that after the audience receives the ICH discourse, they decode the ICH elements in it according to their own cognition. In view of the decoders’different attitudes when they are decoding the symbolic meanings, Hall applies three scenarios to describe the three positions of the audience in the decoding process, namely, the dominant position, the negotiated position, and the confrontational position. The decoding process of ICH requires mutual feedback between encoding and decoding processes, in order to achieve good communication effects, and the secondary encoding is needed when necessary.FindingsLack of EncoderAt present, most of villages of the Grand Canal have not paid much attention to the cultivation of the ICH inheritors, and some masters of art have passed away, the problem of their aging being serious, and some kinds of ICH are facing the dilemma of no one to encode it, such as Work Song of Boatmen, Woodcut New Year Pictures. Fewer ICH tourism products are encoded for international tourists, resulting in the weakness of international dissemination. In encoding stage, important issues that need to be solved are how to keep the authenticity of traditional ICH while keeping up with the times, and how to extract potential ICH in each section of the Beijing-Hangzhou Grand Canal that can show the geographical characteristics and highlight the uniqueness of the Grand Canal ICH.Being Poor in Communication EffectThe current dissemination of the Canal ICH is facing the problems of monotonous communication channel and weak interaction with the audience. According to the investigation, three reasons lead to these problems: Firstly, there is a lack of derivative products from the reprocessing and re-creation of ICH elements in tourism products or tourist attractions, resulting in tourists’ unclear concept of intangible cultural heritage (Haleh, Mohammad, & Neda, 2019) and lack of proper ways to deeply understand ICH elements. Secondly, most of the ICH products are not targeted for different groups or through various channels when they are sold or exhibited, resulting in the weakness of dissemination. Third, there are few channels for communication and interaction between the encoders and decoders, and the weak interaction between decoders and encoders may lead to the insufficient understanding of ICH elements by decoders. The communication channel of ICH for the international public still remains in the traditional way of TV media, so it is difficult for the international public to receive the symbols containing Chinese ICH.Decoders’ Hardness to Stand in Dominant PositionFrom the perspective of decoding effect, the decoding of ICH in tourism products or tourism performancesTHE DISSEMINATION OF INTANGIBLE CULTURAL HERITAGE243in China generally suffers from the problem that the audience decoding the ICH is difficult to be in a dominant position (Guo & Wang, 2019). The main reason is that most kinds of ICH have its unique regional characteristics, but the audience lacks a certain understanding of ICH with local characteristics due to the limitations of geographic space and decoders’ background knowledge. This will lead to deviations in their understanding of the connotations and values expressed by ICH elements in tourism products or performances. Secondly, the encoder will artistically create the ICH elements in tourism products or performances, while the decoder has a subjective understanding of the ICH elements in tourism products or performances due to their prior knowledge level and acceptability, which would lead to unsatisfactory communication effect. Thirdly, the audience’s understanding of ICH is not fed back to the encoder through effective channels, or the encoder does not pay enough attention to the feedback and lacks targeted secondary encoding, which makes it difficult for the audience to be in a dominant position in the decoding process.SolutionsEncoding: Inherit and Innovate Encoding Models, Educating EncoderIn this process, we should enhance the innovation of the encoding mode for ICH tourism products.The first is to innovate the expression of the theme symbol of tourism products. Although ICH itself is intangible, it can be transmitted by means of physical ICH cultural products, which requires the encoder to have an objective and accurate understanding of the ICH involved in the product and avoid the subjective elements being blindly planted into it by the encoder.Second, we should use symbols carrying meaning to transmit these codes innovatively. In the encoding process of ICH tourism products, the encoder should first clarify the thematic direction of the products, combine various carriers for transmitting symbols such as visual transmission or audio transmission, incorporate emerging technologies and equipment into the encoding process, and encode ICH suitable for different types of people, so as to achieve the best effect when transmitting symbols. Focusing on the excavation of potential ICH, the production process of ICH products can help to awaken the non-physical cultural memory of tourists and evoke their cultural memory and cultural identity. In this process, it is more important to excavate the discourse of potential ICH than simply disseminate the textual symbols.In addition, there is a need to focus on the cultivation and education of intangible heritage inheritors. Most living ICH masters are old, and if their skills are not inherited, it will cause irreparable loss of intangible cultural heritage (Qi, 2006). The cooperation with local secondary schools or universities to set up special courses on intangible heritage culture will promote the inheritance of ICH.In addition to hiring traditional talents of ICH, attention should be paid to finding modern talents who master emerging technologies and understand the frontiers of culture so as to achieve the integration of traditional culture and modern technology at the encoding process. It can systematically cultivate multi-talented ICH encoders who are dialectically unified between tradition and modernity, thus highlighting the core of ICH at the encoding stage. Communication: Broaden Communication Channels & Refine Communication Content The ways for ICH dissemination are still traditional and backward at present, and we should try to present and spread brilliant ICH of the Canal. Performing a series of arts activities and festivals in tourist destinations and uploading them to the Internet platform can surely evoke people’s cultural memories and make them identify with the ICH. In this process, attention should be paid to breaking the barrier between different regions, andTHE DISSEMINATION OF INTANGIBLE CULTURAL HERITAGE244harmonizing the relationship between regional characteristics of ICH and internationalization of its content to disseminate ICH abroad. We can also make documentary or online videos, spread coded cultural symbols on media platforms for foreigners, and concentrate on the follow-up work after the dissemination. To avoid aberrant decoding, it is important to consider what is missed or may misguide people in the description of ICH during dissemination, as mass travelers mainly rely on advertisements or brochures to learn about their tourist destinations, and they do not realize that they may subvert the stereotypes. Therefore, the description of ICH is equally crucial in this context (Ira, 1993).Decoding: Increase the Depth of Traveler Participation & Prevent Decoding Mismatches In order to achieve a better circulation effect, the audience’s decoding of the ICH should be oriented to the dominant position. In the dominant position, the decoder can accurately understand the meaning expressed by the Grand Canal ICH performance encoder and can maintain the same understanding of ICH with the encoder. The authenticity of the ICH performance connects encoder and tourists in their spirit, thus seeking deep integration and promoting the cultural identification of the tourists (Miguel, 2008). Experiential ICH tourism allows decoders to participate in ICH tourism actively, shifting decoders in negotiated position or confrontational position to the dominant position. At present, the participatory and experiential aspects of canal ICH tourism products are generally not well enough, tourists basically appreciating them passively. Therefore, we should promote the development of experiential ICH tourism products to integrate touring, entertainment, experience, and learning through engagement, connection, and creation, so as to enhance the participation, interaction, knowledge, and fun of the Grand Canal ICH tourism process and enter into a shared ritualized field (Han, 2014). Secondary Encoding: Collect Feedback & Enhance Consumer StickinessSecondary encoding seems to be a feedback process that may be neglected by the encoders at the end of the circulation, but it is actually significant. In the ICH tourism circulation, some traditional customs of the Canal like Fisherman’s Wedding Ceremony or Sacrifice to the River God are quite ritualistic but it may bring a sense of distance and strangeness to the decoder at the same time. ICH tourism should not only focus on the mode of transmission, but also on the interaction and the feedback of audience (Zhou & Zhang, 2022). Encoders need to focus on post-communication feedback when facing mismatch that occurs between the encoder and the decoder, so as to improve the quality of secondary encoding. In the late stage of circulation, establishing a reasonable feedback mechanism is an urgent issue to be solved, and only when the feedback is really received by the encoder can the secondary encoding be improved. Before the ICH performance, the encoder can design a questionnaire according to its theme, and when the audience enters, the staff distributes the questionnaire to them and collects the feedback from the audience, and then carefully sorts out the feedback. Then the encoders reflect on the results and transform the feedback into the ideas of secondary encoding. Through some new and popular ways such as social media, surveys, or prize quizzes, to keep abreast of the audience’s thoughts and preferences for ICH products. In this way, it is possible to verify the dissemination of encoder’s pre-determined meaning of the ICH symbols after the communication process. So that the understanding of the decoder will be consistent with the encoder’s original intention, and the decoder is always in the dominant position, and thus the dissemination effect can be maximized. The secondary encoding experience of other cultural products also can be used for reference in the development of derivatives and enhancement of consumers’ stickiness. On the basis of catering to decoders’preferences, combining with aspects of decoders’ daily life and online platforms, we can disseminate the encoded ICH symbols into all aspects of decoder’s life.THE DISSEMINATION OF INTANGIBLE CULTURAL HERITAGE245ConclusionThe Grand Canal culture has a long history, and various kinds of ICH with regional characteristics record the way of Chinese lifestyle for thousands of years. By analyzing the dissemination of ICH along the Beijing-Hangzhou Grand Canal with Stuart Hall’s encoding/decoding theory, we can find that the transmission of its ICH is suffering from the lack of encoder, poor communication effect, and the decoders’ hardness to stand in the dominant position. In the encoding stage, ICH circulation should focus on the inheritance, the cultivation of ICH encoders, and the encoding of tourism cultural products. In the communication stage, it should broaden the dissemination channels and refine the contents. In the decoding stage, it should increase the participation of decoders to prevent decoding mismatch and collect feedback from decoders to improve the secondary encoding quality. We should improve the universality and accuracy of ICH in terms of encoding, communication, decoding, and secondary encoding with the help of its immaterial attributes, use modern technology and diversified ways to inherit ICH with its historical connotation, so that decoders are in the dominant position to make ICH of the Canal better inherited and developed.ReferencesChen, L. D., & Lin, Y. F. (2014). Inheritance and innovation: A study of Stuart Hall’s masterpiece Encoding/Decoding. Journalism & Communication, 21(8), 99-112.Claudia, M., & Donna, D. (2021). The construction of intangible cultural heritage: A Foucauldian critique. Annals of Tourism Research, 89(1), 1-11.Evan, L. K. (2015). Using social scientific criteria to evaluate cultural theories: Encoding/decoding theory. KOME, 22(1), 10-26. Guo, X. R., & Wang, N. (2019). Research on the strategy for video transmission of intangible cultural heritage in China from the perspective of coding and decoding theory—Case study of the story of Yanxi Palace. Cultural Industry Research, 2(1), 123-134.Haleh, M., Mohammad, M., & Neda, T. F. (2019). A study on t ourists’ tendency toward intangible cultural heritage as an attraction (Case study: Isfahan, Iran). City, Culture and Society, 17(1), 54-60.Han, B. Y. (2014). The development model of Rizhao intangible cultural heritage from the perspective of tourism. China Journal of Commerce, 20(1), 184-185.Ira, S. (1993). Marketing authenticity in third world countries. Annals of Tourism Research, 20(1), 302-318.Miguel, V. G. (2008). Intangible heritage tourism and identity. Tourism Management, 39(1), 807-810.Qi, Q. F. (2006). Study on the transmission and inheritors in the protection of intangible cultural heritage. Journal of Northwestern Ethnic Studies, 3(1), 114-123.Wu, N. (2007). Information dissemination: A key link in the marketing and service of tourist destinations. Tourism Tribune, 10(1), 67-70.Zhang, B. F. (2020). Study on the interactive model of intangible cultural heritage protection and tourism development in Beijing-Hangzhou Canal. Gansu Theory Research, 1(1), 103-109.Zhou, K., & Zhang, Y. (2022). The function and path of culture communication of intangible cultural heritage tourism: A perspective from the ritual view. Journal of Shandong University (Philosophy and Social Sciences), 4(1), 40-46.Zou, W. H. (2014). A study of Stuart Hall’s theory of culture. Beijing: China Social Sciences Press.。
大数据分析与列数据库近年来随着数据量的激增,对于数据分析的需求也日益迫切,传统的RDBMS已经远远不能满足企业对大数据分析的需求,虽然很多厂商都声称自己具有列数据库的特性,但是绝大多数都不具备处理真正大数据的能力,在今年8月份,Google 在VLDB 2012大会上发表了<< Processing a Trillion Cells per Mouse Click>>论文[1],展示了Google新的大数据分析技术PowerDrill, 本文将借用这篇论文的实验数据,结合笔者的上一篇Hadoop文件格式[2]的内容介绍更多大数据分析中列数据库的核心原理, 希望读者能对列数据库的原理有更多了解,也希望对将来Hadoop在针对数据分析方面能够有更多优化, 并对一些忽悠的厂商和空喊口号的技术有辨别能力。
列文件格式和压缩在常见的列数据库技术中,一个总是被混淆的概念是面向列储存和面向列的压缩(Column storage and Columnar compression, 见参考资料[3]) , 面向列储存指的是将同类数据放在一起,这类数据在物理磁盘和物理内存上表现为连续空间,也就是我们熟称的”将不同列分开放”(这个描述并不准确但是更容易理解), 而面向列的压缩是指将不同的数据以更小的代价存放在磁盘或内存中,它往往包括非常高效的编码和解码技术(Encoding and Decoding) , 比如Run Length Encoding , BitVector Encoding ,真正的列数据库中会包括与这些压缩格式相对应的延迟物化技术(later Materialization), 高效的压缩格式和延迟物化特性是真正列数据库和伪列数据库之间查询性能和集群吞吐能力的最主要差别.高效压缩之Run length EncodingRun length Encoding将同一列的连续数据压缩成它的实际数值和这个数值出现的连续次数,比如AAABBBBBCCCCCCC 这样一个包含15条数据的某列数值,run length encoding 会将它压缩成一个三元数组(实际值,起始位置,个数),比如上面的数值会压缩成[A,1,3][B,4,5][C,8,7]的格式,从而使原始的数据无论在磁盘还是内存中都可以占用更少的空间,由于run length encoding 的特性,数据往往需要重新排序从而得到更好的结果,在实际生产环境中,性别,年龄,城市等选择性非常高的列往往都是run length encoding处理的对象.在列数据库中数据往往会经过多层排序,比如第一层排序为性别,第二层排序为年龄,第三层排序为城市, 即使那些本来选择性不算高的列,在排序之后的小范围区间内也可能使类似的记录满足run length encoding 的压缩条件,从而使记录更加适合压缩.高效压缩之Bit-Vector EncodingBit-vector encoding 是数据仓库中最常用的优化手段,行数据库中使用的一般为bitmap index, 它一般只针对单个列而且是额外的存储结构,列数据库中的bit-vector encoding 主要针对数据本身而且含有较少的唯一值才进行编码,在这种编码中,会先储存所有出现过的值,然后使用bit 数字1来表示实际这个数值是否出现在列中,其他bit位用0来表示. 比如某个chunk的数值为:A A C C D D AB EBit-Vector encoding会使用ABCDE这样的字典来储存实际的值,然后使用:110000100 : 对应bit-string 值A000000010 : 对应bit-string 值B001100000 : 对应bit-string 值C000011000 : 对应bit-string 值D000000001 :对应bit-string 值E在上面的例子中,每一个bit-string 的值没有为8的倍数,所以后面的bit位就被浪费掉了.当唯一值越多,需要编码的数值越多,则整个向量空间越稀疏并且消耗就越大,这是行数据库中bitmap index 低效且不可伸缩的关键因素(包括Hive 0.8 引入的bitmap index也是如此).在列数据库中,因每一部分数据块单独存放(PowerDrill 假设一个数据块大概存放2千万条记录), 并且每个数据块都只维护自己的少量唯一值,所以Bit-Vector encoding所消耗的空间无论是磁盘还是内存都极少并且不会有伸缩方面的问题. 在处理Bit-Vector encoding 的计算时,比如对应上面例子某个查询需要知道字符串为B的个数时,只需要将bit-string B进行位操作即可得到, 这比普通的hashmap 计数器的计算方式会快上几个数量级. Bit-Vector Encoding一般并不要求数据本身排序,但是近来有研究表明不管是对数据表的列顺序还是列顺序一定情况下行数据的重新排序都会使Bit-Vector Encoding使用更少的磁盘和内存空间[6][7]. Google PowerDrill通过实验证明对行数据重新排序会对查询性能有1.2倍到2.8倍的提升,并且内存比不排序的情况下消耗更少.Trie EncodingTrie数据结构一般也叫prefix trees, 一般用在数据类型为string并且排序之后有明显倾斜的数据分布的列,比如URL , 家庭住址, 这些字段的前缀经过排序之后在局部区域往往都有很高的压缩比,在最近的Hbase 里面也使用了这种方式压缩rowKey 的部分,Google PowerDrill也同时使用Trie Encoding压缩由”字典表”和”字典表所在位置”所组成的文件格式及其对应的内存数据结构.其他编码方式和压缩编码和解码不同于压缩,编码和解码一般针对特殊数据和特殊的类型,一般消耗的CPU也远远小于压缩所消耗的CPU,更多时候需要对数据重新排序才能取得更好的压缩比,这种排序既包括列的选择性高低也包括在局部地区重新调整行的顺序. 除了上面提到的Power Drill 常使用的Run length Encoding , Bit-vector encoding ,Trie Encoding 之外, 常见的编码还包括:l 针对字符或文本的”Dictionary Encoding”:比如email 地址, 家庭地址. 这种编码一般不需要排序,主要为了节省储存空间和少量内存空间,对查询处理时间有所提升.l 针对固定间隔类型数据的”Delta Encoding” : 比如日期,时间,时间戳和等间距长的数据类型,一般不需要排序,针对特殊应用,比如定时输出数据的监控系统(主机负载,网络流量等),这种编码无论磁盘还是内存的压缩率都极高,并且对应查询处理时间也有明显提升.l 有时候为了编码会将两个或多个字段进行组合,使用Trie Encoding 或者”变长间隔编码”进行处理,这些编码只在非常特殊的数据类型或者数据倾斜下使用,有时候只减少磁盘空间而对查询时间没有提升,甚至使用不当会增加CPU解码的负担而提升效果较小.Run length Encoding和Bit-Vector Encoding一般对某些列压缩会减少储存3-4个数量级,对内存提升也有2-3个数量级,Dictionary Encoding和Trie Encoding一般对磁盘空间减少大概20倍,对内存空间大概减少5倍,根据Google PowerDrill的实验,在常见的聚合查询中这些特殊的编码方式会对查询速度一般有2-3个数量级不等的提升.上面描述的只是最简单的情况,实际生产环境中要比这复杂的多,run length encoding , Bit-Vector Encoding 和Dictionary Encoding在何时使用的情况比较好判断,有些其他的编码方式则会出现时间和空间转换比率的权衡问题,比如run length encoding对于连续出现次数小于几十以下的情况提升就不明显,还有Dictionary Encoding在建立字典表的时候对于重复次数小于多少次的字符串就不储存在字典表中,以免压缩比率提升不大反而解压缩的消耗反而大增.至于具体的阈值怎么取舍,根据不同的集群硬件情况,数据分布情况,需要作出不同的调整.压缩对编程语言垃圾回收也非常有提升,因为在物理内存上更加连续,使得gc 的处理时间缩短, 操作系统page cahe 换入换出更快,具体可以查看参考资料[3]压缩往往是针对原始二进制数据,对不同数据类型的提升差别不大,生产系统中一般同时使用编码解码和压缩. 常用的压缩算法包括gzip,bzip,LZO,snappy 等,在Google PowerDrill 的实验中,对已经使用特殊编码和解码的数据继续压缩对内存和处理效率已经提升不大,甚至有可能为了减少内存空间而增加查询处理的延迟,google权衡考虑cpu的消耗,内存提升效率,解压缩的速度而使用了一个修改版的LZO 压缩算法, 并称相比较已经编码和解码的数据,修改版的LZO压缩还能提高1.4倍到2倍的磁盘空间和10%的内存空间,同时解压缩速度比google开源的snappy要快。
5.1 编码5.2 解码5.3 编解码选项(speex_*_ctl)5.4 模式查询5.5 封包和带内信令补充后记The libspeex library contains all the functions for encoding and decoding speech with the Speex codec. When linking on a UNIX system, one must add -lspeex -lm to the compiler command line. One important thing to know is that libspeex calls are reentrant, but not thread-safe. That means that it is fine to use calls from many threads, but calls using the same state from multiple threads must be protected by mutexes. Examples of code can also be found in Appendix A and the complete API documentation is included in the Documentation section of the Speex website (/).Speex编解码器的libspeex包囊括了所有的语音编码和解码函数。
在Linux 系统中连接时,必须在编译器命令行中加入-lspeex –lm。
需要知道的是,虽然libspeex的函数调用是可重入的,但不是线程安全的,所以在多线程调用时,如果使用共享资源需要进行互斥保护。
附录A中有代码实例,在Speex站点(/ )的文档部分能下到完整的API文档。
5.1 编码In order to encode speech using Speex, one first needs to:#include <speex/speex.h>Then in the code, a Speex bit-packing struct must be declared, along with a Speex encoder state:SpeexBits bits;void *enc_state;The two are initialized by:speex_bits_init(&bits);enc_state = speex_encoder_init(&speex_nb_mode);For wideband coding, speex_nb_mode will be replaced by speex_wb_mode. In most cases, you will need to know the frame size used at the sampling rate you are using. You can get that value in the frame_size variable (expressed in samples, notbytes) with:speex_encoder_ctl(enc_state,SPEEX_GET_FRAME_SIZE,&frame_size);In practice, frame_size will correspond to 20 ms when using 8, 16, or 32 kHz sampling rate. There are many parameters that can be set for the Speex encoder, but the most useful one is the quality parameter that controls the quality vs bit-rate tradeoff.This is set by:speex_encoder_ctl(enc_state,SPEEX_SET_QUALITY,&quality);where quality is an integer value ranging from 0 to 10 (inclusively). The mapping between quality and bit-rate is described in Fig. 9.2 for narrowband. Once the initialization is done, for every input frame:speex_bits_reset(&bits);speex_encode_int(enc_state, input_frame, &bits);nbBytes = speex_bits_write(&bits, byte_ptr, MAX_NB_BYTES);where input_frame is a (short *) pointing to the beginning of a speech frame, byte_ptr is a (char *) where the encoded frame will bewritten,MAX_NB_BYTES is the maximumnumber of bytes that can be written to byte_ptr without causing an overflow and nbBytes is the number of bytes actually written to byte_ptr (the encoded size in bytes). Before callingspeex_bits_write, it is possible to find the number of bytes that need to be written by calling speex_bits_nbytes(&bits), which returns a number of bytes. It is still possible to use the speex_encode() function, which takes a (float *) for the audio. However, this would make an eventual port to an FPU-less platform (like ARM) more complicated. Internally, speex_encode() andspeex_encode_int() are processed in the same way. Whether the encoder uses the fixed-point version is only decided by the compile-time flags, not at the API level.After you’re done with the encoding, free all resources with:speex_bits_destroy(&bits);speex_encoder_destroy(enc_state);That’s about it for the encoder.使用Speex进行语音编码,首先要:#include < speex/speex.h >在代码中,需要声明Speex比特包结构体,同时设置Speex编码器状态:SpeexBits bits;void * enc_state;初始化两变量:speex_bits_init( &bits );enc_state = speex_encoder_init( &speex_nb_mode );用speex_wb_mode代替为speex_nb_mode,即可转换为宽带编码。
斯图亚特霍尔:编码/解码理论斯图亚特·霍尔:编码/解码理论作者: gaohongbo786 发表日期: 2006-05-30 17:03 复制链接[人物简介] 斯图亚特·霍尔(Stuart Hall,1931— ),英国文化研究的杰出代表人之一。
曾任英国伯明翰大学的“当代文化研究中心”(Center for Contemporary Cultural Studies,简称CCCS)主任。
终身致力于媒介和大众文化的研究。
霍尔的名声不是基于他自己的哪一本书,而在于交织在热烈论争之中的文章和文集序言。
他最广为人知的重要贡献是提出了一种有关编码与解码的理论,认为受众对媒介文化产品的解释,与他们在社会结构中的地位和立场相对应。
他提出三种假想的地位,即:以接受占统治地位的意识形态为特征的“主导—霸权的地位”,大体上按照占统治地位的意识形态进行解释,但却加以一定修正以使之有利于反映自身立场和利益的“协商的符码”,以及与占统治地位的意识形态全然相反的“对抗的符码”。
霍尔的研究成为在特定的社会文化语境中研究受众接受行为的理论背景。
此后,文化研究敞开了关于电视受众主动性的研究的大门,一种新范式的受众研究兴起并迅速扩展开来。
霍尔的主要论著有:《电视讨论中的编码和译码》(Encoding and Decoding in the Television Discourse,1973),《文化研究:两种范式》(Cultural Studies: Two Paradigms,1980),《“意识形态”的再发现:媒介研究中被压抑者的回归》(1982),《意识形态与传播理论》(Ideology and Communication Theory,1989),《文化身份与族裔散居》,《文化、传媒与“意识形态”效果》,《结构“大众”笔记》等,1980年出版专著《文化、传媒、语言》(Media , Culture and Society, Academic Press, London)。
English Alphabetic Code with the International Phonetic AlphabetThe English language has a fascinating history – but this has resulted in a complexalphabetic codefor the writing system whereby the 26 letters of the alphabetrepresent the 44 or so smallest sounds identifiable in English speech in three complicated ways:1. one sound (phoneme) can be represented byone, two, three or four letters: e.g./a/ ain apple, /f / ph inph otogra ph , /igh / igh in n igh t, /oa / ough in d ough 2. one sound can be represented by multiple spelling alternatives (graphemes ): e.g. /oa /: o , oa , ow , oe , o-e , eau , ough3. one grapheme (letter or letter group) can represent multiple sounds : e.g. ‘ough’: /oa / th ough , /or / th ough t, long /oo / thr ough , /ou / pl ough , /u / thor ough On this Alphabetic Code Chart , the units of sound (phonemes or combined phonemes) are shown in slash marks. Vowel sounds are shown in red and consonant sounds are shown in blue. The vowel sounds provide the main volume and depth in spoken words whereas the consonant sounds are generally much quieter and sometimes very high-pitched such as /s / and /t /. Teachers need to teach the separate units of sounds carefully, avoiding the added ‘schwa’ or “uh ” sound: e.g. “sss ” not “suh ”; “t ” not “tuh ”.units of sound + IPA symbolssimple codekey words complex code graphemes or spelling alternatives + key words which are code for the soundsinformation/a / /æ/ aa ppleThe Synthetic Phonics Teaching PrinciplesTeach the KNOWLEDGE of the alphabetic code ; that is, theletter/s-sound correspondences.Teach the THREE CORE SKILLS :1. DECODING : Sound out and blend all-through-the-printed-word for reading unknown words.2. ENCODING : Orally segment (identify) the sounds all-through-the-spoken-word for spelling; then select the correct graphemes AS CODE FOR the identified sounds in that particular word.3. HANDWRITING : Hold the pencil with the tripod grip and form correctly the 26 upper case and 26 lower case letters on writing lines ./e / /ɛ/ e e gg-ea h ea d -ais ai d ag ai n/i / /ɪ/ ii nsect-yc y mbals /o / /ɒ/ o o ctopusw a w a tchqu a qu a lify a lt s a lt/u / /ʌ/ u u mbrellao s o n -ou t ou ch -ough no thor ough fare/ai //e ɪ/ai first ai d-ay tr ay a t a ble -ae sund ae a -e c a k e-ey pr ey-ea br ea keigh eigh t-aighstr aigh t ______/ee//i:/eeeelea ea t e e mu e -econcr e t e Teach a simple code (basic ortransparent ) first; that is, mainly one spelling for each sound at a rate of two to five letter/s-soundcorrespondences per week. The simple code is part of the complex code – a first step towards teaching the alphabetic code.Keep the simple code revised and begin to introduce spelling and pronunciation alternatives of the complex code (extended ,advanced or opaque code ) at a rate appropriate to the age, stage and ability of the learners.APPLICATIONProvide a cumulative bank of words, sentences and texts at code level : 1. to model blending, segmenting for spelling, and handwriting 2. for each learner to practise his or her growing skills of blending, segmenting and handwriting increasingly independently.Provide cumulative , decodable reading books at code level .‘Two-pronged ’ teaching approachTeach a systematic , planned synthetic phonics programme alongside incidental teaching of any letter/s-sound correspondences as required for differentiation, wider reading and spelling and for the wider curriculum - for individuals, groups and whole classes.-ey k ey -ie ch ie f -i nesard i nesbetween/i and ee / -ysunn y -ey monk ey -ie mov ie /igh / /a ɪ/ -igh n igh t-ie t ie i beh i nd -y fl y i -e b i k e eiei der duck/oa //əʊ/ oa oa k treeow b ow o y o -y o-oe ob oe o -e r o p e-ough d ough -eau plat eau /y +oo / /j/ + /u:/ -uebarbec ueu u nicorn u -e t u b eew n ew eu pn eu matic drillshort /oo / /ʊ/ -oo b oo k -oul sh oul d -u p u sh -ow o lf w o lveslong /oo //u:/ oo m oo n-ue bl ueu -e fl u t e-ew cr ew-ui fr ui t-ou s ou p -o m o ve-ough thr ough/oi / /ɔɪ/oioi ntmentoy t oyow-al for oar oor oreaw au ar araughur orthdayer our -arair are -ear ereeer ear ere ieroor urebbqueck chameleondd edghphotogra phgg gu ghgedge gelemm me -mbnn knngnk ncppqu kwrr wrss ce c ise scissors ps eudonymtt btvew whboo kscks kesgspe gszz se ze ch tch u/ture sh chonth/on ure zure (blue)gePlease note that this version of an Alphabetic Code Chart is not definitive. Further code may be discovered in both common and unusual words. The word ‘。
/**@file* libavcodec API use example.* Note that libavcodec only handles codecs (mpeg, mpeg4, etc...),* not file formats (avi, vob, mp4, mov, mkv, mxf, flv, mpegts, mpegps, etc...). See library 'libavformat' for the* format handling*/#include "libavutil/imgutils.h"#include "libavutil/opt.h"#include "libavcodec/avcodec.h"#include "libavutil/mathematics.h"#include "libavutil/samplefmt.h"#define INBUF_SIZE 4096#define AUDIO_INBUF_SIZE 20480#define AUDIO_REFILL_THRESH 4096 //大写字母一般是常数,切记/* Audio encoding example*/音频编码static void audio_encode_example(const char *filename)//参数就是编码的文件,包括路径{ AVCodec *codec; //codec,下面的找编码器用到,是整数么?AVCodecContext *c= NULL;//上下文环境,int frame_size, i, j, out_size, outbuf_size;FILE *f;short *samples;float t, tincr;uint8_t *outbuf;printf("Audio encoding\n");/* find the MP2 encoder 编码器?*/codec = avcodec_find_encoder(CODEC_ID_MP2);//返回0时表明打到了,这个API返回avcodec if (!codec) {fprintf(stderr, "codec not found\n");exit(1);}c = avcodec_alloc_context3(codec);//储存上下文环境/*设置参数,都是AVCodecContext的成员变量put sample parameters */c->bit_rate = 64000;c->sample_rate = 44100;c->channels = 2;c->sample_fmt = AV_SAMPLE_FMT_S16;/* open it 打开流文件*/if (avcodec_open(c, codec) < 0) {fprintf(stderr, "could not open codec\n"); exit(1); }/* the codec gives us the frame size帧尺寸, in samples */frame_size = c->frame_size;samples = malloc(frame_size * 2 * c->channels);outbuf_size = 10000;outbuf = malloc(outbuf_size);//这些都是自己设置的么?f = fopen(filename, "wb");//文件if (!f) {fprintf(stderr, "could not open %s\n", filename);exit(1);}/* encode a single tone sound 编码单色声音?核心代码吧*/t = 0;//浮点数?tincr = 2 * M_PI * 440.0 / c->sample_rate;for(i=0;i<200;i++) {for(j=0;j<frame_size;j++) {samples[2*j] = (int)(sin(t) * 10000);samples[2*j+1] = samples[2*j];t += tincr;}/* encode the samples */out_size = avcodec_encode_audio(c, outbuf, outbuf_size, samples);fwrite(outbuf, 1, out_size, f);}fclose(f);free(outbuf);free(samples);avcodec_close(c);av_free(c);}/** Audio decoding解码.*/static void audio_decode_example(const char *outfilename, const char *filename)//解码文件{AVCodec *codec;AVCodecContext *c= NULL;int len;FILE *f, *outfile;uint8_t inbuf[AUDIO_INBUF_SIZE + FF_INPUT_BUFFER_PADDING_SIZE];AVPacket avpkt;AVFrame *decoded_frame = NULL;av_init_packet(&avpkt);printf("Audio decoding\n");/* find the mpeg audio decoder */codec = avcodec_find_decoder(CODEC_ID_MP2);if (!codec) {fprintf(stderr, "codec not found\n");exit(1);}c = avcodec_alloc_context3(codec);/* open it */if (avcodec_open(c, codec) < 0) {fprintf(stderr, "could not open codec\n");exit(1);}f = fopen(filename, "rb");if (!f) {fprintf(stderr, "could not open %s\n", filename);exit(1);}outfile = fopen(outfilename, "wb");if (!outfile) {av_free(c);exit(1);}/* decode until eof */avpkt.data = inbuf;avpkt.size = fread(inbuf, 1, AUDIO_INBUF_SIZE, f);while (avpkt.size > 0) {int got_frame = 0;if (!decoded_frame) {if (!(decoded_frame = avcodec_alloc_frame())) {fprintf(stderr, "out of memory\n");exit(1);}} elseavcodec_get_frame_defaults(decoded_frame);len = avcodec_decode_audio4(c, decoded_frame, &got_frame, &avpkt);if (len < 0) {fprintf(stderr, "Error while decoding\n");exit(1);}if (got_frame) {/* if a frame has been decoded, output it */int data_size = av_samples_get_buffer_size(NULL, c->channels,decoded_frame->nb_samples,c->sample_fmt, 1);fwrite(decoded_frame->data[0], 1, data_size, outfile);}avpkt.size -= len;avpkt.data += len;avpkt.dts =avpkt.pts = AV_NOPTS_VALUE;if (avpkt.size < AUDIO_REFILL_THRESH) {/* Refill the input buffer, to avoid trying to decode* incomplete frames. Instead of this, one could also use* a parser, or use a proper container format through* libavformat. */memmove(inbuf, avpkt.data, avpkt.size);avpkt.data = inbuf;len = fread(avpkt.data + avpkt.size, 1,AUDIO_INBUF_SIZE - avpkt.size, f);if (len > 0)avpkt.size += len;}}fclose(outfile);fclose(f);avcodec_close(c);av_free(c);av_free(decoded_frame);}/* * Video encoding example视频编码*/static void video_encode_example(const char *filename, int codec_id){AVCodec *codec;AVCodecContext *c= NULL;int i, out_size, size, x, y, outbuf_size;FILE *f;AVFrame *picture;uint8_t *outbuf;printf("Video encoding\n");/* find the mpeg1 video encoder */codec = avcodec_find_encoder(codec_id);if (!codec) {fprintf(stderr, "codec not found\n");exit(1);}c = avcodec_alloc_context3(codec);picture= avcodec_alloc_frame();/* put sample parameters */c->bit_rate = 400000;/* resolution must be a multiple of two */c->width = 352;c->height = 288;/* frames per second */c->time_base= (AVRational){1,25};c->gop_size = 10; /* emit one intra frame every ten frames */c->max_b_frames=1;c->pix_fmt = PIX_FMT_YUV420P;if(codec_id == CODEC_ID_H264)av_opt_set(c->priv_data, "preset", "slow", 0);/* open it */if (avcodec_open(c, codec) < 0) {fprintf(stderr, "could not open codec\n");exit(1);}f = fopen(filename, "wb");if (!f) {fprintf(stderr, "could not open %s\n", filename);exit(1);}/* alloc image and output buffer */outbuf_size = 100000;outbuf = malloc(outbuf_size);/* the image can be allocated by any means and av_image_alloc() is * just the most convenient way if av_malloc() is to be used */av_image_alloc(picture->data, picture->linesize,c->width, c->height, c->pix_fmt, 1);/* encode 1 second of video */for(i=0;i<25;i++) {fflush(stdout);/* prepare a dummy image *//* Y */for(y=0;y<c->height;y++) {for(x=0;x<c->width;x++) {picture->data[0][y * picture->linesize[0] + x] = x + y + i * 3;}}/* Cb and Cr */for(y=0;y<c->height/2;y++) {for(x=0;x<c->width/2;x++) {picture->data[1][y * picture->linesize[1] + x] = 128 + y + i * 2;picture->data[2][y * picture->linesize[2] + x] = 64 + x + i * 5;}}/* encode the image */out_size = avcodec_encode_video(c, outbuf, outbuf_size, picture);printf("encoding frame %3d (size=%5d)\n", i, out_size);fwrite(outbuf, 1, out_size, f);}/* get the delayed frames */for(; out_size; i++) {fflush(stdout);out_size = avcodec_encode_video(c, outbuf, outbuf_size, NULL);printf("write frame %3d (size=%5d)\n", i, out_size);fwrite(outbuf, 1, out_size, f);}/* add sequence end code to have a real mpeg file */outbuf[0] = 0x00;outbuf[1] = 0x00;outbuf[2] = 0x01;outbuf[3] = 0xb7;fwrite(outbuf, 1, 4, f);fclose(f);free(outbuf);avcodec_close(c);av_free(c);av_free(picture->data[0]);av_free(picture);printf("\n");}/* * Video decoding example */static void pgm_save(unsigned char *buf, int wrap, int xsize, int ysize,char *filename){FILE *f;int i;f=fopen(filename,"w");fprintf(f,"P5\n%d %d\n%d\n",xsize,ysize,255);for(i=0;i<ysize;i++)fwrite(buf + i * wrap,1,xsize,f);fclose(f);}static void video_decode_example(const char *outfilename, const char *filename){AVCodec *codec;AVCodecContext *c= NULL;int frame, got_picture, len;FILE *f;AVFrame *picture;uint8_t inbuf[INBUF_SIZE + FF_INPUT_BUFFER_PADDING_SIZE];char buf[1024];AVPacket avpkt;av_init_packet(&avpkt);/* set end of buffer to 0 (this ensures that no overreading happens for damaged mpeg streams) */memset(inbuf + INBUF_SIZE, 0, FF_INPUT_BUFFER_PADDING_SIZE);printf("Video decoding\n");/* find the mpeg1 video decoder */codec = avcodec_find_decoder(CODEC_ID_MPEG1VIDEO);if (!codec) {fprintf(stderr, "codec not found\n");exit(1);}c = avcodec_alloc_context3(codec);picture= avcodec_alloc_frame();if(codec->capabilities&CODEC_CAP_TRUNCATED)c->flags|= CODEC_FLAG_TRUNCATED; /* we do not send complete frames *//* For some codecs, such as msmpeg4 and mpeg4, width and height MUST be initialized there because this information is notavailable in the bitstream. *//* open it */if (avcodec_open(c, codec) < 0) {fprintf(stderr, "could not open codec\n");exit(1);}/* the codec gives us the frame size, in samples */f = fopen(filename, "rb");if (!f) {fprintf(stderr, "could not open %s\n", filename);exit(1);}frame = 0;for(;;) {avpkt.size = fread(inbuf, 1, INBUF_SIZE, f);if (avpkt.size == 0)break;/* NOTE1: some codecs are stream based (mpegvideo, mpegaudio) and this is the only method to use them because you cannotknow the compressed data size before analysing it.BUT some other codecs (msmpeg4, mpeg4) are inherently framebased, so you must call them with all the data for oneframe exactly. You must also initialize 'width' and'height' before initializing them. *//* NOTE2: some codecs allow the raw parameters (frame size, sample rate) to be changed at any frame. We handle this, soyou should also take care of it *//* here, we use a stream based decoder (mpeg1video), so we feed decoder and see if it could decode a frame */avpkt.data = inbuf;while (avpkt.size > 0) {len = avcodec_decode_video2(c, picture, &got_picture, &avpkt);if (len < 0) {fprintf(stderr, "Error while decoding frame %d\n", frame);exit(1);}if (got_picture) {printf("saving frame %3d\n", frame);fflush(stdout);/* the picture is allocated by the decoder. no need tofree it */snprintf(buf, sizeof(buf), outfilename, frame);pgm_save(picture->data[0], picture->linesize[0],c->width, c->height, buf);frame++;}avpkt.size -= len;avpkt.data += len;}}/* some codecs, such as MPEG, transmit the I and P frame with a latency of one frame. You must do the following to have achance to get the last frame of the video */avpkt.data = NULL;avpkt.size = 0;len = avcodec_decode_video2(c, picture, &got_picture, &avpkt);if (got_picture) {printf("saving last frame %3d\n", frame);fflush(stdout);/* the picture is allocated by the decoder. no need tofree it */snprintf(buf, sizeof(buf), outfilename, frame);pgm_save(picture->data[0], picture->linesize[0],c->width, c->height, buf);frame++;}fclose(f);avcodec_close(c);av_free(c);av_free(picture);printf("\n");}int main(int argc, char **argv)//主函数,好好看下面的函数运用….{const char *filename;/* must be called before using avcodec lib 必须声明*/avcodec_init();/* register all the codecs */avcodec_register_all();//初始化libavformat/libavcodec:if (argc <= 1) {audio_encode_example("/tmp/test.mp2");audio_decode_example("/tmp/test.sw", "/tmp/test.mp2");//直接调用上面的函数,//mp2音频变为.sw音频video_encode_example("/tmp/test.h264", CODEC_ID_H264);video_encode_example("/tmp/test.mpg", CODEC_ID_MPEG1VIDEO);filename = "/tmp/test.mpg";} else {filename = argv[1];}// audio_decode_example("/tmp/test.sw", filename);video_decode_example("/tmp/test%d.pgm", filename);return 0;}。