3028|3

68

帖子

0

TA的资源

一粒金砂(初级)

楼主
 

在bootloader中开到了图像的压缩方法 [复制链接]

我今天在修改eboot的开机logo的时候发现我的bootloader中居然是用了压缩算法  我人为是压缩算法
下面是源程序,这个图像的压缩是怎么实现的?

#define RLE_MARK        0x1234

static void
rle_express(const unsigned short *src, unsigned short *tgt, int cnt)
{
    unsigned short a;
    unsigned short n;
    unsigned short i;

    while (cnt)
    {
        a = *src++;

        if (a == RLE_MARK)
        {
            a = *src++;
            n = *src++;
            for (i = 0; i < n; i++)
                *tgt++ = a;
            cnt -= 3;
        }
        else
        {
            *tgt++ = a;
            cnt--;
        }
    }
}




下面是那个数组


//
// Copyright (c) Microsoft Corporation.  All rights reserved.
//
//
// Use of this source code is subject to the terms of the Microsoft end-user
// license agreement (EULA) under which you licensed this SOFTWARE PRODUCT.
// If you did not accept the terms of the EULA, you are not authorized to use
// this source code. For a copy of the EULA, please see the LICENSE.RTF on your
// install media.
//
/*++
THIS CODE AND INFORMATION IS PROVIDED "AS IS" WITHOUT WARRANTY OF
ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED TO
THE IMPLIED WARRANTIES OF MERCHANTABILITY AND/OR FITNESS FOR A
PARTICULAR PURPOSE.

Module Name: bitmap.c

Date Created: 10/30/2002

Abstract: This file contains a 16 bpp bitmap image displayed during boot-up.

Functions:

Notes:

--*/
#include


const unsigned short ScreenBitmap[] =
{
/* File Size = 25800, Zipped Size = 8a8c, 23 % */
0x1234,0xffff,0x0d2f,0x0000,0x0000,0x0000,0x1234,0xffff,0x0027,0x0000,0x0000,0x0000,0xffff,0xffff,0xffff,0x0000,
0x0000,0x0000,0x1234,0xffff,0x00bd,0x0000,0x0000,0x0000,0x1234,0xffff,0x0027,0x0000,0x0000,0x0000,0xffff,0xffff,
0xffff,0x0000,0x0000,0x0000,0x1234,0xffff,0x00bd,0x0000,0x0000,0x0000,0x1234,0xffff,0x0027,0x0000,0x0000,0x0000,
0xffff,0xffff,0xffff,0x0000,0x0000,0x0000,0x1234,0xffff,0x003a,0xffdf,0xffff,0xffff,0xffdf,0xffff,0xffdf,0x1234,
0xffff,0x007d,0x0000,0x0000,0x0000,0x1234,0xffff,0x0027,0x0000,0x0000,0x0000,0x1234,0xffff,0x0044,0xffdf,0x1234,
0xffff,0x001b,0xffdf,0xffff,0xffff,0xffff,0xffdf,0x1234,0xffff,0x005e,0x0000,0x0000,0x0000,0x1234,0xffff,0x0027,
0x0000,0x0000,0x0000,0x1234,0xffff,0x0041,0xffdf,0x1234,0xffff,0x0004,0xffdf,0x1234,0xffff,0x0019,0xffdf,0x1234,
0xffff,0x0005,0xffdf,0x1234,0xffff,0x005c,0x0000,0x0000,0x0000,0x1234,0xffff,0x0009,0x1234,0x0000,0x0009,0xffff,
0xffff,0xffff,0x1234,0x0000,0x0009,0xffff,0xffff,0xffff,0x1234,0x0000,0x0009,0xffff,0xffff,0xffff,0x0000,0x0000,
0x0000,0xffff,0xffff,0xffff,0x1234,0x0000,0x0009,0xffff,0xffff,0xffff,0x1234,0x0000,0x0009,0x1234,0xffff,0x0024,
0xffdf,0xffff,0xffdf,0x1234,0xffff,0x001c,0xffdf,0xffff,0xffff,0xffff,0xffdf,0xffff,0xffdf,0x1234,0xffff,0x005b,
0x0000,0x0000,0x0000,0x1234,0xffff,0x0009,0x1234,0x0000,0x0009,0xffff,0xffff,0xffff,0x1234,0x0000,0x0009,0xffff,
0xffff,0xffff,0x1234,0x0000,0x0009,0xffff,0xffff,0xffff,0x0000,0x0000,0x0000,0xffff,0xffff,0xffff,0x1234,0x0000,
0x0009,0xffff,0xffff,0xffff,0x1234,0x0000,0x0009,0x1234,0xffff,0x0022,0xffdf,0xffdf,0xffff,0xef5d,0xb576,0x7bef,
0xd67a,0x1234,0xffff,0x001d,0xffdf,0x1234,0xffff,0x005e,0x0000,0x0000,0x0000,0x1234,0xffff,0x0009,0x0000,0x0000,
0x0000,0xffff,0xffff,0xffff,0x0000,0x0000,0x0000,0x1234,0xffff,0x0009,0x0000,0x0000,0x0000,0xffff,0xffff,0xffff,
0x0000,0x0000,0x0000,0xffff,0xffff,0xffff,0x0000,0x0000,0x0000,0xffff,0xffff,0xffff,0x0000,0x0000,0x0000,0xffff,
0xffff,0xffff,0x0000,0x0000,0x0000,0xffff,0xffff,0xffff,0x0000,0x0000,0x0000,0xffff,0xffff,0xffff,0x0000,0x0000,
0
。。。。。。。。。。。。。。。。。。。。。。。。。。。。。。。。。。。。。。。。。。。。。。。。。。。。。。
太长截之
};

最新回复

嗯应该就是这样实现的  不过他的压缩的源码没有 呵呵 要自己编一个  详情 回复 发表于 2009-7-18 13:41
点赞 关注

回复
举报

76

帖子

0

TA的资源

一粒金砂(初级)

沙发
 
看起来像是一个是数字,一个是数字的个数。。
 
 

回复

72

帖子

0

TA的资源

一粒金砂(初级)

板凳
 
就是说你的ScreenBitmap 数组是经过原始图片压缩后转化的数组,原始数组比你的ScreenBitmap 数组要长,当你显示图片的时候就要还原你的原始数组了;其实rle_express这个函数就是还原原始数据的过程,我觉得叫解压函数更合理些,解压的规则很简单,就是当你的数组里出现了0x1234,就说明你压缩了一些数据,这些数据的值就是0x1234后下一个数据,数据的个数就是0x1234的下下一个数了,这是我的理解,不知道对不对?
 
 
 

回复

72

帖子

0

TA的资源

一粒金砂(初级)

4
 
嗯应该就是这样实现的  不过他的压缩的源码没有 呵呵 要自己编一个
 
 
 

回复
您需要登录后才可以回帖 登录 | 注册

随便看看
查找数据手册?

EEWorld Datasheet 技术支持

相关文章 更多>>
关闭
站长推荐上一条 1/9 下一条

 
EEWorld订阅号

 
EEWorld服务号

 
汽车开发圈

About Us 关于我们 客户服务 联系方式 器件索引 网站地图 最新更新 手机版

站点相关: 国产芯 安防电子 汽车电子 手机便携 工业控制 家用电子 医疗电子 测试测量 网络通信 物联网

北京市海淀区中关村大街18号B座15层1530室 电话:(010)82350740 邮编:100190

电子工程世界版权所有 京B2-20211791 京ICP备10001474号-1 电信业务审批[2006]字第258号函 京公网安备 11010802033920号 Copyright © 2005-2025 EEWORLD.com.cn, Inc. All rights reserved
快速回复 返回顶部 返回列表