File conversion between Y4M and Raw YUV format

It’s easy to convert between the two formats as long as you have a fairly recent release of MJPEGTools package installed. Here are the examples on Fedora 21:

  • Suppose we have a raw YUV file named BasketballDrill_832x480_50.yuv. This file is one of the HEVC test sequences in 4:2:0 planar format. The display aspect ratio (DAR) should be 16:9. Following is the command line to convert it to Y4M format:

    $cat BasketballDrill_832x480_50.yuv | yuv4mpeg -w 832 -h 480 -x 420mpeg2 -a 40:39 -i p -r 50:1 > BasketballDrill.y4m

    Note that we specify the pixel aspect ratio (PAR), rather than DAR, in the command line.

  • Once the Y4M file is created, we can use the following command line to view the file:

    $yuvplay < BasketballDrill.y4m

  • In the case that we need to strip a Y4M file down to a raw YUV file so we can feed it to an encoder that does not accept Y4M as input, we can use the following command line:

    $y4mtoyuv < BasketballDrill.y4m > BasketballDrill.yuv

For more information, refer to the man pages of the package.

发表在 Computer | 留下评论

Remotely debug programs running on the Parallella board

I am running the Parallella board in the headless mode, normally I’ll just start a VNC session and connect to the board. However, debugging programs running on Parallella board with GDB in a terminal window is really painful.

I tried installing and using DDD in the VNC session, but failed to get it working. It’s always stuck at a stage complaining that GDB is busy. That’s why I was forced to use GDBserver, instead.

Now, in order to debug an ARM program the DDD on host would need access to the binary image of the built ARM program. There are two convenient ways to make the image accessible by DDD.

The first method is to cross-build for Parallella on host and install the binaries to a directory on host. The next step would be to export that directory as an NFS share, so that the Parallela board can mount that NFS share and run the program. However, this method does not work for now since the Parallella SDK right now does not support cross-building nicely.

This leaves the second method as the only good one I can think of. The program is built native on Parallella, and the directory that contain the source tree is exported. The host mounts the directory and then has access to the images. Note that the default kernel in the Ubuntu image provided by Adapteva does not have NFS support so a customary kernel would need to be built. The detailed information on building a kernel for Parallella can be found on the forum.

I am running 32-bit Fedora as my host OS. Initially, I thought that I have to install the arm-none-eabi-gdb package as the inferior debugger under DDD. However, that’s always causing a protocol error. Until one time I inadvertently supplied the native GDB as the inferior debugger, everything suddenly works. I am still scratching my head on this. But it looks like the natively-built GDB on x86 can recognized binaries built for ARM and communicate with ARM targets correctly. Now I don’t get why the arm-none-eabi-gdb package is needed at all.

Once we can mount exported share of Parallella on the host, we are ready to kick start debugging process:

  1. On the host, mount the exported share first:

    $sudo mount -t nfs parallella:/home/linaro/Work ~/parallella

  2. On the Parallella, we can start the program to be debugged like the example below:

    $gdbserver localhost:65432 ffmpeg_g -f hevc -i str.bin -f rawvideo decoded.yuv

  3. On the host, change directory to where the binary image resides, and start DDD:

    $ddd ffmpeg_g

    Once inside the debugger console of DDD, we can connect to the GDB server running on Parallella:

    (gdb) target remote parallella:65432

    Once the connection is established, we can use DDD as usual. Once we complete the debugging session, we can detach from the server:

    (gdb) detach

If there is communication issue between the GDB client and the server, here are two links for understanding the root cause of the issue:

发表在 Computer | 留下评论

地理 物产 (16)

油类

茶油。(——以茶树子榨油,色淡黄,味甘香清洁,一名清油。其树有高至六七尺者,与采茶芽之树及山茶花树皆不同,只叶似山茶而略小,枝干屈曲多瘿节。分二种,一种子大,名大茶子。一种子小,名小茶子,俗呼珍珠子,油味更香洌。均于每年小阳春着花,至次年九十月间采子。备具四时之气。仁可榨油,壳可为炭。枯饼为炭更耐久。真食物中佳品。)

桕油。(——取乌桕子榨油,铅俗呼为水油。乌桕本作【木咎】。唐本草作乌凹。陈藏器云叶可染,皂子压为油涂头令白变黑。然灯极明,又名鹀舅。)

皮油。(——即就水油之浮皮者取出,可以为烛。)

麻油。(——取胡麻仁榨油,味极香甘。荤素食品中生用最佳。入药可滑胎疗疮。熬膏多用之凉血解毒,止痛生肌。)

花生油。(——取落花生榨油。油亦可佐食品之用。卖者每以掺茶油。识者辨之,多不采买,以其难于久X,且味亦远逊也。)

菜油。(——采芸苔菜子榨油。点灯极明,不亚水油而妙在无烟。读书灯尤宜。)

樟子油。(——以樟树子榨油。气恶劣难闻,足以辟蚊蚋,驱蚤虱。乡间农人多用之。)

 

发表在 铅山县志 | 留下评论

地理 物产 (15)

纸类

纸。(——其料皆以末叶嫩竹,渍之,捣之,蒸之,曝之而成。粗细不同,名色亦异。细洁而白者有连四,毛边,贡川,京川,上关。白之次者有毛六,毛八,大则,中则,黑关。细洁而黄者有厂黄,南宫。黄之次者有黄尖,黄表。多出东西南三乡。至于粗而适用,则有大筐,小筐,放西,放帘,九连,帽壳,统谓之毛纸。邑之各乡皆出。细纸难成,毛纸易就。铅山土物此为第一。)

 

发表在 铅山县志 | 留下评论

地理 物产 (14)

虫类

石蜦。(——形似蛙,大小不一。至大有十余两重者。皮黄黑色,生深山石涧中。夏月暑热,夜凉则出。群伏石上,虽以火烛之不走。铅人识其性,燃薪攫取,易若探囊。食有补益,味尤鲜美。)

泥蜦。(——铅俗名乌蝦蟆。状类石蜦而皮黑厚。产草泽中。土人攫取食之。肉粗,味不甚鲜滑。其性较热,无所滋补。)

黄蛤。(——状肖青蛙,味鲜可食。生山谷中。每正二月南风稍动,则群出。似蝦蟆而大,黄色。能吞气,饮风露,不食杂虫。人因而捕之。然其来有时,其去无迹,亦一奇也。)

蝦蟆。(——一名蟾蜍。即癞蝦蟆也。蟆多生陂泽间,形小,皮上多黑斑点。入夏鸣声不绝。蟾蜍多生下湿出,形大,背上多麻磊。行极迟缓,不能跳跃,亦不解鸣。二物虽一类,功用小别。)

蜈蚣。(——蜈蚣春出冬蛰,节节有足。双须歧尾,性畏蜘蛛。以溺射之即断烂。)

蛙。(——后脚长,故善跃。大其声,则曰蛙。小其声,则曰蛉。南人食之,呼为田鸡。云肉味如鸡也。又曰坐鱼,其性好坐也。生水中。即尔雅所谓在水曰黾者是也。浙东人以为佳肴。考工记云,以脰鸣者,蛙黾之属。农人占其声之早晚以卜丰歉。)

蚯蚓。(——蚓之行也,引而后伸。其塿如丘。尔雅谓之,螼螾『怨(虫代心)』蟺。曲蟺,象其状也。在物应土,德在星,禽为轸。水上食槁,壤下饮黄泉。)

蚁。(——有君臣之义,故字从义。大者为蚍蜉,亦曰马蚁。赤者名蠪。飞者名螱。有大小黑黄赤白数种。穴居卵生。其居有等,其行有队。能知雨候,春出冬蛰。壅土成封,曰蚁封。)

蜻蛉。(——一名蜻蟌,言其色青葱。蛉虰,言其状伶仃。或云其尾如丁,或云其尾好亭而挺。故曰蝏,曰蛵。俗名纱羊。言其翅如纱也。大头,露目,短颈,长腰,軃尾。翼薄如纱。食蚊虻,饮露水。)

蜂。(——有蜡蜂,黄蜂,土蜂之不同。要皆其尾垂锋,故谓之蜂。群居有王,王大于众。一日两衙应潮。王下雄者尾锐,雌者尾歧。嗅花则以须代鼻。采花则以股抱枝。王元之记云,王之无毒似君德也,营巢如台似建国也,子复为王似分定也,拥王而行似绻主也,王所不螫似遵法也,王失则溃守义节也,取惟得中似什一而税也,谓之有君臣之义信然。铅人每养蜡蜂以取蜜。自一二桶至数十桶不等。然或可招而来,或不麾而去,其权不尽操之人也。)

莹。(——一名夜光,一名熠耀。常于大暑前后飞腾,是得大火之气而化,故明照如此。有二种。一小而宵飞,腹下光明。茅根所化,月令所谓腐草化为莹也。一长如蛆蠋,尾后有光,无翼不飞,月令所谓腐草化为【益蜀】也。)

蛱蝶。(——蛾类也。大曰蝶,小曰蛾。其种甚繁,红白各异。有草蝶,木蝶,各因所类而化。皆四翅,好嗅花香,以须代鼻。其交以鼻,交则粉退。庄周梦为蝴蝶,栩栩然不知周为蝶,蝶为周。)

螳螂。(——尔雅谓之不过。骧首奋臂,修颈大腹。二手四足,善缘而捷。以须代鼻,喜食人发。能翳叶捕蟬,俗皆呼为虎螳螂。)

蜘蛛。(——布网其丝右绕。其类甚多,大小颜色不一。尔雅但分蜘蛛,草王,蟰,蛸,四种而已。安石字说,设一面之网,物触而后诛之,知乎诛义者,故曰蜘蛛。晋重耳曰,人之有知,不能廓垂天之网,布络地之绳。是不知蜘蛛之知。)

蝙蝠。(——俗呼皮翼,一名夜燕。人家及岩谷中皆有之。变化论曰,形似鼠,灰黑色,有薄肉翅连合四足及尾如一。夏出冬蛰,日伏夜飞,食蚊蚋。自能生育。夜值庚申乃伏。)

蚕。(——孕丝虫也。种类甚多,大小白乌斑色各异。其虫属阳,喜燥恶湿。食而不饮,三眠三起,二十七日而老。自卵出而【虫少】,自【虫少】蜕而蚕。蚕而茧,茧而蛹,蛹而蛾,蛾而卵,卵而复【虫少】。亦有胎生者,与母同老。盖神虫也。食桑叶吐丝,可以衣被天下。铅山妇女间亦养之。然惟取其丝作断锦零纨用之。从无用机织成片段者,可惜也。)

蛗螽。(——一名蚱蜢。谓其瘦长,窄而猛也。种类蝗而大小不一。长角修股,亦能害稼。五月动股作声,至冬入土穴中。)

蝼蛄。(——铅俗名土狗。穴地粪壤中而生。夜则出外求食,有短翅四足。雄者善鸣而飞,雌者腹大羽小不善飞翔。吸风食土,喜就灯光。立夏后至夜则鸣,声如蚯蚓。)

蟋蟀。(——似蝗而小,正黑,光泽如漆。有角翅。豳风,十月蟋蟀,入我床下。五月名斯螽,六月又名莎鸡。随时变化而异其名。)

蝇。(——夏出冬蛰,喜暖恶寒。苍者乱声,青者乱色。)

竈马。(——穴竈而居。酉阳杂俎,竈马状如促织稍大。脚长。俗云,竈有马,足食之兆。)

蜣螂。(——深目高鼻,背负黑甲。大者身黑而光,腹翼下有小黄子附母而飞。昼伏夜出,见灯光则来。小者身黑而暗,昼飞夜伏,常以土包粪,转而成丸,雄曳雌推,置于坎中。覆之数日,有小蜣螂出。盖孚乳于中也。)

蟬。(——诸蜩总名。方首广额,两翼六足。以胁而鸣,吸风引露,溺而不粪。)

蛇。(——篆文象其宛转屈曲之形,其形委蛇,故名。但其类不一。在禽为翼火,在卦为巽风,在神为元武,在物为毒虫。春出冬蛰。出则食物,蛰则含土。其舌双,其耳聋,其行纡,听以目,食以吞。性畏蜈蚣。铅山近草泽处皆有。)

石龙子。(——一名蜥蜴。尔雅谓之守宫。铅俗呼为壁虎。似蛇有四足。头扁尾长形细,长七八寸,有鳞金碧色。生山石间,能吐雹,可祈雨。故得龙子之名。)

天牛。(——大如蟬,黑甲,光如漆。甲有黄白点,甲下有翅能飞。目前有二黑角,前向如水牛角能动。其喙黑而扁,如钳,甚利,亦似蜈蚣喙。六足在腹,乃诸蠹虫所化也。夏月有之,出则主雨。)

壁钱。(——似蜘蛛作白幕如钱,贴墙壁间。北人呼为壁X,铅人呼为壁蟢。形扁,斑色,八足而长。亦时蜕壳。)

鼠妇。(——一名蛜蝛。多在下湿处壅器底,及土穴中。诗,蛜蝛在室。)

果蠃。(——黑色,细腰,銜泥于人屋及器物边作房。每取桑虫教祝,变成己子。诗,螟蛉有子,果蠃负之。铅俗呼为土蜂。)

【虫民】。(——夏出冬蛰,昼伏夜飞。化生木叶,龟鳖畏之。东方朔有言曰,长喙细身,昼亡夜存,咂人肌肤,吸血恶灯。为掌指X,臣朔愚戆,名之曰蚊。铅山惟河口二堡无此,亦一奇也。)

纺织娘。(——形似蚱蜢而身肥,音较促织更极其悠长清越。笼挂廊檐,值宵深月白之际,梦回枕上,俗耳为之一清。铅俗呼为纺织娘。)

 

发表在 铅山县志 | 留下评论

地理 物产 (13)

介类

青螺。(——生水田中,状类蜗牛而尖。长大者如梨,小者如李。其壳旋文,其肉视月盈亏。王充云,月毁于天,螺消于渊。)

鳖。(——铅俗名团鱼。水居陆生,穹脊连胁。与龟同类。礼,秋献鳖鱼。诗,炰鳖脍鲤。淮南子,鳖无耳而守神。守神之名以此。庄子,东海之鳖,左足未入而右膝已絷矣。尔雅,翼公输子般见蠡出头,以足画之。蠡引闭其户,终不可开。因效之设为门户。)

蚌。(——与蛤同类而异形。长者曰蚌,员者曰蛤。故蚌从丰,蛤从合。皆象形也。今人称为蚌蛤者,混也。蚌类甚繁,出水中。其肉可食,壳可为粉。易离为蚌,刚在外也。)

蟹。(——又曰无肠公子,横行甲虫也。外刚内柔,于卦象离。八足二螯,雄曰狼螘,雌曰博带。腹中之黄应月盈亏。六足者名彭蜞,有毒。食之伤人。)

龟。(——甲虫三百六十,龟为之长。龟形象离,其神在坎。上隆而文以法天。下平而理以法地。背阴向阳,蛇头龙颈。外骨内肉,肠属于首,能运任脉。易,舍尔灵龟。书,纳锡大龟。)

 

发表在 铅山县志 | 留下评论

地理 物产 (12)

鳞类

鳇鱼。(——正字通,鳇鱼即鳣鱼。故尔雅释鱼注云,鳣大似鱏而短鼻,口在頷下,体有邪行,甲无鳞,肉黄色。大者长二三丈,江东呼为黄鱼。陆机草木虫鱼疏亦云,鱏出江海,三月中从河下头来上,形似龙。头锐,口在頷下,背上腹下皆有甲。肉可蒸为臛,又可为鲊。鱼子可为酱。本非铅邑土产,不当有。然得自狮江輒称祥瑞。逢会试之年三月,获此以预卜南宫喜兆,尤历验不爽。)

草鱼。(——性舒缓。形似鲤,色黑。头较扁,口较阔。身圆而长,肉厚而松。因食草,俗呼为草鱼。其种取诸大江,每年三四月间,商人乘巨舰往九江一带,广收鱼子,于船中多置水缸,育成鱼苗,载归贩卖。土人买而畜之池,饲以草,易肥大,有重至十余斤者。又或渔人从河中网得,呼为港草。肥美亦不亚池中所畜。按本草,鲩似鲤。草鱼疑即是鲩类。)

鲤鱼。(——正字通神农书曰,鲤为鱼王。无大小脊旁鳞皆三十有六。鳞上有小黑点,文有赤,白,黄三种。陶弘景本草,鲤形既可爱,又能神变,乃至飞越山湖,所以琴高乘之。酉阳杂俎,道书以鲤多为龙,故不欲食。)

鳙鱼。(——正字通,似鲢。大头细鳞,目旁有骨。史记司马相如传,鰅鳙鰬魠。注,郭璞曰,鳙似鲢而黑。故鲢之美在腹,鳙之美在头。以其头大而脂膏多也。)

鲢鱼。(——博雅云,【魚典】也。陆机虫鱼疏,【魚典】,徐州人谓之鲢。状如鳙而头小,形扁,细鳞,肥腹。其色白。)

鲫鱼。(——一名鲋。埤雅,鲫鱼旅行以相即,故谓之鲫。以相附,又谓之鲋。性善偎泥,不食杂物。能补胃。冬月肉厚子多,味尤美。)

鳝鱼。(——即鱓鱼。鳝与鱓同音,皆上演切。尔雅,翼鱓,似蛇无鳞,体有涎沫。夏月于浅水作窟。本草图经,鱓似鳗鲡而细长,亦似蛇而无鳞。有青黄二色,生水岸泥窟中。杨震传有鹳雀啣三鱓鱼,飞集讲堂前。都谓取鱼进曰蛇鱓者,卿大夫服之象也。故名其堂为鱓堂。韩非说苑并假【魚亶】字为鱓字。可见【魚亶】鱓二字,古通用。有以鱓堂为【魚亶】堂。)

鰌鱼。(——字同鳅,俗呼泥鳅。说文,【魚習】也。尔雅释鱼,【魚習】鰌。注,今泥鰌。疏,【魚習】,一名鰌,穴于泥中。正字通,鰌生下田浅沼中,似鱓而短。首锐,色黄黑有『剺(水代刀)』,濡滑难握,穴泥中与他鱼牝牡。荆公云,鱼梁亦自富虾鰌。)

鲭鱼。(——本草图经,青鱼,古作鲭字。广韵集韵丛,仓经切,音青。此鱼青色有枕骨。正字通,形似鲩鱼,青色,即青鱼。南人以为鮓。)

鳜鱼。(——五篇,鱼大口细鳞斑彩,正字通,鱼扁性阔腹,大口细鳞,皮厚肉紧。味如豚,一名水豚。)

鲨鱼。(——尔雅释鱼注疏,鲨,一名鮀,今吹沙小鱼。陆机云,鱼狭而小,尝张口吹沙。通雅,鲨,吹沙小鱼。黄皮黑斑。正月先至。身前半阔而扁,后方而狭。)

鳊鱼。(——殆即鲂鱼。按说文,鳊字义同鯾。玉篇,鯾,鲂鱼也。山海经,大鯾居海中。注,鯾即鲂也。尔雅释鱼注,江东呼鲂为鳊。陆机虫鱼疏,鲂鱼,广而薄肥,恬而少力。细鳞鱼之美者。正字通,鲂鱼小头缩项,阔腹穹脊,细鳞,色青白。腹内肪甚腴。后汉马融传,鲂鱮鱏鲾。注曰,鳊,鲂之类也。襄阳耆旧传,汉中鳊鱼甚美,常禁人捕,以槎断水,因谓槎头缩项鳊。)

鳠鱼。(——鳠字集韵胡故切,音护。韵会,胡化切,又音华。尔雅释鱼注,鳠似鲇而大,白色。本草图经,鮧鱼之口腹俱大者为鳠。俗皆呼为华鱼。)

鳢鱼。(——铅俗呼为乌鳢鱼。即七星鱼。有七星,夜朝北斗,得自然之礼,故名曰鳢鱼。道家谓之水压。卫生歌云,雁行有序犬有义,黑鱼拱北知臣礼。人无礼义反食之,天地鬼神皆不喜。又正字通,鳢即今乌鱼。)

鳡鱼。(——体似鯮而腹平,头似【鱼宛】而口大,类似鲇而色黄,鳞似鳟而稍细。大者三四十【角力】。性善啖鱼。本草,鳡鱼一名鳏鱼。其性独行,故曰鳏。)

鳟鱼。(——说文,赤目鱼也。陆机虫鱼疏,鳟似鯶鱼而鳞细于鯶,赤眼。)

金鱼。(——有龙头鱼,凤尾鱼,鸭蛋鱼。自宋始有,今则人家养玩者甚多。春末生子草上,好自呑『稻(口代禾)』。亦易生化。初出黑色,久则变红,或白,或花,红白相间。)

鮠鱼。(——本草图经,鮠鱼口小背黄腹白。正字通,鮠似鲇而大。白色,背有肉髻。狮江往往获此。味甚鲜滑肥美,肚尤滋补。)

鳗鲡鱼。(——状如蛇,背有肉鬣连尾。无鳞,有舌,腹白。大可数尺,小亦尺余。脂膏甚多,每夜出。土人以绳安铁钩置潭中,饵以鳅鱼,往往钩获。味最肥腻并补益虚损。病瘵者食之即愈。)

虾。(——产溪池,大小不一。色青,磔须,钺鼻,背有断节,尾有硬鳞。多足而好跃。其肠属脑,其子在腹。取大者蒸曝去壳,谓之虾米。)

发表在 铅山县志 | 留下评论