猫吐是什么原因| ca724是什么意思| vc什么意思| 36计第一计是什么| 祥林嫂是什么样的人| 不眠夜是什么意思| 雷特综合症是什么症状| prada什么牌子| 金贵肾气丸治什么病| 手上脱皮什么原因| 越来越什么| 篮球中锋是干什么的| 侧写是什么意思| 蜂蜜有什么功效| 翳是什么意思| 亮油什么时候涂| 静脉曲张做什么检查| sss是什么意思| 猫咪取什么名字好听| 康复治疗学什么| 新生儿吐奶是什么原因| 圣灵是什么意思| 灵芝孢子粉什么时候吃最好| 本虚标实是什么意思| 珍珠奶茶的珍珠是什么做的| 上岸了是什么意思| 考试前紧张吃什么药最好能缓解| 副脾是什么意思| 什么人生病从来不看医生| 腺体肠化是什么意思| 面红耳赤是什么生肖| hhh是什么意思| 断生是什么意思啊| 小孩出虚汗是什么原因| 神经损伤吃什么药| 输卵管堵塞什么症状| 612是什么星座| 含羞草长什么样| 吃什么紧致皮肤抗衰老| 什么叫间质瘤| 刚拔完牙需要注意什么| 水痘疫苗第二针什么时候打| 脑干出血是什么原因造成的| 蛲虫吃什么药| 胎儿头围偏大什么原因| 泡桐是什么| 脚冰冰凉是什么原因| 世界上最贵的烟是什么烟| 为什么会心肌缺血| 洋芋是什么| 什么是唐卡| 移交是什么意思| 什么时间量血压最准| 妒忌是什么意思| 脖子不舒服看什么科| 什么情况下会得甲亢| 小孩早上起床咳嗽是什么原因| 激素6项检查是些什么| 试婚是什么意思啊| 抗血小板是什么意思| 营销号是什么| 孔子姓什么名什么| 西夏国是现在什么地方| 低烧挂什么科| 鸡眼是什么原因引起的| 头皮疼是什么原因引起的| 1970年五行属什么| 八月十五什么星座| 薄熙来为什么被抓| 2034年是什么年| 瑾字是什么意思| 阴道壁是什么样的| 一片狼藉是什么意思| 纯字五行属什么| 总是低烧是什么原因造成的| 怀孕两天会有什么反应| cd什么意思| 血小板压积偏低是什么意思| 宫颈非典型鳞状细胞是什么意思| 上挂是什么意思| 囡是什么意思| 左旋肉碱什么时候吃效果好| 老什么什么什么| 人参有什么功效| 水鱼是什么意思| 夏季喝什么茶好| 肠梗阻是什么| model是什么意思| 九转大肠是什么菜系| 食指戴戒指代表什么| 办理身份证需要什么| 什么是平板电脑| 百合和拉拉有什么区别| 大便溏薄是什么意思| 扫货是什么意思| 曲马多是什么| 肛裂出血用什么药| 艾灸肚脐眼有什么好处| 舌头白色是什么原因| 验孕棒什么时候测最准| 3月1号是什么星座| 匙仁是牛的什么部位| 富态是什么意思| gv是什么| 什么时候夏至| 腰椎管狭窄吃什么药| 为什么会有鼻炎| 为什么一进去就射了| 梦到兔子是什么征兆| 什么叫物理| 04年是什么年| 有毒是什么意思| 嗜酸性粒细胞偏高是什么意思| 竹肠是什么部位| 植物神经紊乱吃什么中成药| 甲亢可以吃什么| 休渔期是什么时候| 阴平阳秘是什么意思| 郝字五行属什么| 鼻子油腻是什么原因| 见字如面什么意思| 灰飞烟灭是什么意思| 减肥期间适合吃什么| 身体缺钾吃什么可以补充| 小学什么时候放假| 撰稿是什么意思| 脖子粗大是什么病的症状| o型血和什么血型最配| 米醋是什么| 一月20号是什么星座| 老婆饼是什么馅| 大腿淤青是什么原因| 免贵姓是什么意思| 今天吃什么菜好呢| 严重失眠吃什么药管用| 胃火吃什么中成药| 十万个为什么作者是谁| 待业什么意思| 送葬后回家注意什么| 一个月不来月经是什么原因| 强烈的什么| 为什么不建议割鼻息肉| 杜冷丁是什么药| 爱是什么偏旁| 红参和高丽参有什么区别| 喝什么茶最减肥| 肉桂属于什么茶| 蹲马步有什么好处| 经期提前是什么原因| 磁共振是什么| 梅毒螺旋体抗体阴性是什么意思| 味美思是什么酒| 氯是什么| 10属什么| 11月什么星座| 猪日冲蛇什么意思| 隐翅虫咬了用什么药膏| 喉咙有浓痰是什么原因| 1939年属什么生肖| ad是什么病的简称| 固本培元什么意思| 老年骨质疏松疼痛有什么好疗法| 超声波是什么意思| 麒麟臂什么意思| 上梁是什么意思| 男人胸前有痣代表什么意思| 什么食物胆固醇含量高| 血红蛋白高是什么原因| 降肝火喝什么茶| 小孩长白头发是什么原因| 什么风什么面| 皮肤发痒用什么药| 促甲状腺素高是什么意思| 一动就大汗淋漓是什么原因| 黄连是什么| 苯氧乙醇是什么| 正常的月经是什么颜色| 为什么女人阴唇会变大| 冬虫夏草有什么功效与作用| 轻度高血压吃什么食物可以降压| 贴士是什么意思| 无创什么时候出结果| 鼻子出血是什么原因引起的| 手指甲有竖纹是什么原因| 什么子孙| 什么叫性生活| 肝右叶低密度灶是什么意思| 喝菊花茶有什么好处| 血压低压低是什么原因| 生吃大蒜有什么好处| 英雄难过美人关是什么意思| 雾是什么| 苎麻是什么面料| 带状疱疹能吃什么食物| 梦到黑狗是什么意思| 燕窝什么时候吃好| 肠痉挛有什么症状| 金银花和什么搭配喝好| 开水冲服是什么意思| e是什么牌子| 女人腰上有痣代表什么| 性生活过后出血是什么原因| 安踏是什么品牌| 男同性恋叫什么| 落井下石是什么意思| 吴亦凡为什么叫牛| offer是什么| 脑动脉瘤是什么原因引起的| 烽烟是什么意思| 每天喝柠檬水有什么好处| 月经前几天是什么期| 肾炎是什么原因引起的| 土黄色裤子配什么颜色上衣| 半身不遂是什么原因引起的| 多囊是什么症状| 阳虚是什么症状| 立flag是什么意思| 小孩腿抽筋是什么原因引起的| 氨水是什么东西| 为什么蚊子要吸血| acc是什么意思| 生力军什么意思| 什么时候闰九月| 孩子积食发烧吃什么药| 胸膜炎有什么症状| 不什么不什么的成语| 法国用什么货币| 五塔标行军散有什么功效| 子宫在肚脐眼什么位置| 胃酸不能吃什么食物| 中性粒细胞百分比高是什么原因| 71年的猪是什么命| 十月二十二是什么星座| 什么叫八字| 什么原因引起尿路感染| 扎西德勒是什么意思| 猪八戒的武器叫什么| 肚脐眼为什么会有臭味| 微量泵是干什么用的| 不以为意什么意思| 什么都不想做| 和田玉和翡翠有什么区别| 伯母是什么意思| 银耳和什么一起煮最好| 公主抱是什么意思| 古人的婚礼在什么时间举行| 大象的耳朵有什么作用| 正骨有什么好处和坏处| 艾司唑仑是什么药| 脚发烫是什么原因| 盗窃是什么意思| 2000年龙是什么命| 一日三餐是什么生肖| 胃一阵一阵的疼是什么原因| 房东是什么意思| 孩子肚脐眼下面疼是什么原因| 精神寄托是什么意思| 左眼一直跳是什么原因| 山竹里面黄黄的是什么| 鼻子两侧挤出来的白色东西是什么| 肺炎后遗症有什么症状| 药物流产后吃什么好| 躺枪是什么意思| 铉是什么意思| 百度Jump to content

甘肃娶妻60万元湖北配18金 年轻人表示娶不起

From Wikipedia, the free encyclopedia
百度   谈到华盛顿的治安,有人斥之为谋杀之都,有人则啧啧称赞,虽有些夸张,但都符合事实,区别在于着眼于哪个世界。

Run-length encoding (RLE) is a form of lossless data compression in which runs of data (consecutive occurrences of the same data value) are stored as a single occurrence of that data value and a count of its consecutive occurrences, rather than as the original run. As an imaginary example of the concept, when encoding an image built up from colored dots, the sequence "green green green green green green green green green" is shortened to "green x 9". This is most efficient on data that contains many such runs, for example, simple graphic images such as icons, line drawings, games, and animations. For files that do not have many runs, encoding them with RLE could increase the file size.

RLE may also refer in particular to an early graphics file format supported by CompuServe for compressing black and white images, that was widely supplanted by their later Graphics Interchange Format (GIF).

RLE also refers to a little-used image format in Windows 3.x that is saved with the file extension rle; it is a run-length encoded bitmap, and was used as the format for the Windows 3.x startup screen.

History and applications

[edit]

Run-length encoding (RLE) schemes were employed in the transmission of analog television signals as far back as 1967.[1] In 1983, run-length encoding was patented by Hitachi.[2][3][4] RLE is particularly well suited to palette-based bitmap images (which use relatively few colours) such as computer icons, and was a popular image compression method on early online services such as CompuServe before the advent of more sophisticated formats such as GIF.[5] It does not work well on continuous-tone images (which use very many colours) such as photographs, although JPEG uses it on the coefficients that remain after transforming and quantizing image blocks.

Common formats for run-length encoded data include Truevision TGA, PackBits (by Apple, used in MacPaint), PCX and ILBM. The International Telecommunication Union also describes a standard to encode run-length colour for fax machines, known as T.45.[6] That fax colour coding standard, which along with other techniques is incorporated into Modified Huffman coding,[citation needed] is relatively efficient because most faxed documents are primarily white space, with occasional interruptions of black.

Algorithm

[edit]

RLE has a space complexity of ??, where n is the size of the input data.

Encoding algorithm

[edit]

Run-length encoding compresses data by reducing the physical size of a repeating string of characters. This process involves converting the input data into a compressed format by identifying and counting consecutive occurrences of each character. The steps are as follows:

  1. Traverse the input data.
  2. Count the number of consecutive repeating characters (run length).
  3. Store the character and its run length.

Python implementation

[edit]
Imports and helper functions
from itertools import repeat, compress, groupby

def ilen(iterable):
    """
    Return the number of items in iterable.

    >>> ilen(x for x in range(1000000) if x % 3 == 0)
    333334
    """
    # using zip() to wrap the input with 1-tuples which compress() reads as true values.
    return sum(compress(repeat(1), zip(iterable)))
def rle_encode(iterable, *, length_first=True):
    """
    >>> "".join(rle_encode("AAAABBBCCDAA"))
    '4A3B2C1D2A'
    >>> "".join(rle_encode("AAAABBBCCDAA", length_first=False))
    'A4B3C2D1A2'
    """
    return (
        f"{ilen(g)}{k}" if length_first else f"{k}{ilen(g)}" # ilen(g): length of iterable g
        for k, g in groupby(iterable)
    )

[7]

Decoding algorithm

[edit]

The decoding process involves reconstructing the original data from the encoded format by repeating characters according to their counts. The steps are as follows:

  1. Traverse the encoded data.
  2. For each count-character pair, repeat the character count times.
  3. Append these characters to the result string.

Python implementation

[edit]
Imports
from itertools import chain, repeat, batched
def rle_decode(iterable, *, length_first=True):
    """
    >>> "".join(rle_decode("4A3B2C1D2A"))
    'AAAABBBCCDAA'
    >>> "".join(rle_decode("A4B3C2D1A2", length_first=False))
    'AAAABBBCCDAA'
    """
    return chain.from_iterable(
        repeat(b, int(a)) if length_first else repeat(a, int(b))
        for a, b in batched(iterable, 2)
    )

[7]

Example

[edit]

Consider a screen containing plain black text on a solid white background. There will be many long runs of white pixels in the blank space, and many short runs of black pixels within the text. A hypothetical scan line, with B representing a black pixel and W representing white, might read as follows:

WWWWWWWWWWWWBWWWWWWWWWWWWBBBWWWWWWWWWWWWWWWWWWWWWWWWBWWWWWWWWWWWWWW

With a run-length encoding (RLE) data compression algorithm applied to the above hypothetical scan line, it can be rendered as follows:

12W1B12W3B24W1B14W

This can be interpreted as a sequence of twelve Ws, one B, twelve Ws, three Bs, etc., and represents the original 67 characters in only 18. While the actual format used for the storage of images is generally binary rather than ASCII characters like this, the principle remains the same. Even binary data files can be compressed with this method; file format specifications often dictate repeated bytes in files as padding space. However, newer compression methods such as DEFLATE often use LZ77-based algorithms, a generalization of run-length encoding that can take advantage of runs of strings of characters (such as BWWBWWBWWBWW).

Run-length encoding can be expressed in multiple ways to accommodate data properties as well as additional compression algorithms. For instance, one popular method encodes run lengths for runs of two or more characters only, using an "escape" symbol to identify runs, or using the character itself as the escape, so that any time a character appears twice it denotes a run. On the previous example, this would give the following:

WW12BWW12BB3WW24BWW14

This would be interpreted as a run of twelve Ws, a B, a run of twelve Ws, a run of three Bs, etc. In data where runs are less frequent, this can significantly improve the compression rate.

One other matter is the application of additional compression algorithms. Even with the runs extracted, the frequencies of different characters may be large, allowing for further compression; however, if the run lengths are written in the file in the locations where the runs occurred, the presence of these numbers interrupts the normal flow and makes it harder to compress. To overcome this, some run-length encoders separate the data and escape symbols from the run lengths, so that the two can be handled independently. For the example data, this would result in two outputs, the string "WWBWWBBWWBWW" and the numbers (12,12,3,24,14).

Variants

[edit]
  • Sequential RLE: This method processes data one line at a time, scanning from left to right. It is commonly employed in image compression. Other variations of this technique include scanning the data vertically, diagonally, or in blocks.
  • Lossy RLE: In this variation, some bits are intentionally discarded during compression (often by setting one or two significant bits of each pixel to 0). This leads to higher compression rates while minimally impacting the visual quality of the image.
  • Adaptive RLE: Uses different encoding schemes depending on the length of runs to optimize compression ratios. For example, short runs might use a different encoding format than long runs.

See also

[edit]

References

[edit]
  1. ^ Robinson, A. H.; Cherry, C. (1967). "Results of a prototype television bandwidth compression scheme". Proceedings of the IEEE. 55 (3). IEEE: 356–364. doi:10.1109/PROC.1967.5493.
  2. ^ "Run Length Encoding Patents". Internet FAQ Consortium. 21 March 1996. Retrieved 14 July 2019.
  3. ^ "Method and system for data compression and restoration". Google Patents. 7 August 1984. Retrieved 14 July 2019.
  4. ^ "Data recording method". Google Patents. 8 August 1983. Retrieved 14 July 2019.
  5. ^ Dunn, Christopher (1987). "Smile! You're on RLE!" (PDF). The Transactor. 7 (6). Transactor Publishing: 16–18. Retrieved 2025-08-07.
  6. ^ Recommendation T.45 (02/00): Run-length colour encoding. International Telecommunication Union. 2000. Retrieved 2025-08-07.
  7. ^ a b "more-itertools 10.4.0 documentation". August 2024.
[edit]
精子有点黄是什么原因 睡觉老做梦是什么原因 什么的小船 铁窗泪什么意思 梦见很多蜘蛛是什么意思
莎莎舞是什么意思 突然长胖很多是什么原因 杜仲有什么功效 qid医学上是什么意思 什么叫阴吹
网罗是什么意思 红鸡蛋用什么染 喝葡萄汁有什么好处 蒲公英什么时候采最好 蛋白过敏是什么症状
什么叫轻度脂肪肝 出气不顺畅是什么原因 青字五行属什么 春光乍泄是什么意思 血糖高能喝什么茶
老婆生日送什么鲜花hcv8jop0ns5r.cn 小腹痛男性什么原因hcv8jop1ns3r.cn homie什么意思hcv7jop9ns3r.cn tf卡是什么jinxinzhichuang.com 三唑磷主要打什么虫hcv8jop0ns9r.cn
维生素什么牌子好hcv9jop7ns0r.cn 什么是偏爱hcv7jop9ns2r.cn 脖子粗挂什么科hcv8jop7ns5r.cn 骨裂是什么感觉hcv8jop5ns9r.cn 喝茶喝多了有什么坏处xianpinbao.com
云南白药里的保险子有什么作用hcv9jop1ns4r.cn 破关是什么意思hcv8jop7ns5r.cn 黑苦荞茶有什么功效hcv8jop2ns1r.cn 吃什么降钾最快hcv8jop3ns5r.cn 蔗糖素是什么hcv8jop5ns0r.cn
痹是什么意思hcv8jop7ns8r.cn 蜂蜜和柠檬一起喝有什么作用wzqsfys.com 发烧应该挂什么科hcv9jop6ns5r.cn 梦见豹子是什么预兆hcv9jop6ns9r.cn 麻薯粉是什么粉hcv9jop3ns9r.cn
百度