base64 - 0 : 이론 -

연습 2015. 10. 3. 23:15

 base64란, 컴퓨터가 표현하고 있는 문자 방식(1byte로 표현할 수 있는 최댓값)은 256가지이다.


 하지만, 이런 경우를 생각해보자.


 문서(문자열로만 구성된 파일)을 보내는데, 대상이 문서로 표현할 수 없는 데이터로 이루어 져있다면, 어떻게 보낼 것인가?


 여기서 모든 플랫폼에 서로 대응하는 형태를 가져야될 것이다.


 이것을 64가지(숫자, 알파벳 대/소문자, 기타 기호 몇개)로 표현하는 방식이다.


 이 방식의 문제점은 용량의 증가가 존재한다는 문제가 있다.(약 33%가량이 증가한다고 한다.)


 이 방식은 메일 및 기타 방식에 사용되며, 암호와는 전혀 관계가 없다.


 그냥 인코딩하는 것이다. 암호는 알고리즘과 키가 밝혀졌을때, 최대한 그 암호 문서를 늦게 풀어내는 것이 목적이다.(공개키) 하지만, Base64는 남에게 숨길려고 드는 목적을 가지고 있지 않다.


 심지어, Base64는 키라는 존재도, 특정한 존재에게만 열리도록 목적을 가지고 있지 않다.


 1. Base64는 암호용 알고리즘이 아니다.


 그렇다고 Base64가 암축용으로 만들어진 것도 아니다. 오히려 용량이 늘었으면 늘었지(256가지로 표현된 데이터를 64가지로 표현하기 때문에 늘어날 수 밖에 없다.) 줄어들 경우는 없다.


 2. Base64는 압축용 알고리즘이 아니다.


 그렇다면, 왜 Base64가 존재하는가?


 그것은 쉽게 이렇게 들수 있다.


 파일은 올릴 수 없고, 게시판에 이미지 파일을 올려야 될 경우에.

 Base64을 이용하면, 쉽게 사용이 가능하다.


 Base64와 HTML5을 이용한 비디오 출력


 다음과 같은 효과를 얻을 수 있으며, 음악, 사진, 동영상, 파일등 모두다 가능하다.


 그 외에도 메일(MIME)에도 사용이 가능하다.

'연습' 카테고리의 다른 글

Google Brotli - Brotli.exe -  (0) 2015.10.06
base64 -1 : base64 응용 -  (0) 2015.10.04
OpenCL 프로그래밍 공부 -시작-  (0) 2015.10.02
CSS3 -3D Flip Animation-  (0) 2015.09.30
ffprobe 사용법 -영상 정보 보기-  (0) 2015.09.30
Posted by JunkMam
,

이 책을 사서 공부 할려고 한다.
이책에선 Windows 7이 기준이며, 2012년도 라이브러리만 설명이 되어 있어서 최근 설명이 부족하지만, 이 책을 참조하면서 분석하면 될 것 같다.

이 책에서 설명하는 대로 찾아서 설치는 되지만, 차이가 많이 난다.

Intel에서는 INDE라는 녀석이 되어있고(책에선 Intel SDK for OpenCL Application이다.)

CUDA도 조금 다르다.


하지만, 애플, AMD, NVIDIA, intel등을 한번에 정의해서 적어 둔것이기 때문에 쓸만 할 것 같다.

'연습' 카테고리의 다른 글

base64 -1 : base64 응용 -  (0) 2015.10.04
base64 - 0 : 이론 -  (0) 2015.10.03
CSS3 -3D Flip Animation-  (0) 2015.09.30
ffprobe 사용법 -영상 정보 보기-  (0) 2015.09.30
ffmpeg 사용 -mp4 to webm convert(mp4을 webm으로 변환)-  (0) 2015.09.29
Posted by JunkMam
,

CSS3 -3D Flip Animation-

연습 2015. 9. 30. 22:14



front
back



소스 예제


1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
<style type="text/css">
        /* simple */
        .flip-container {
            -webkit-perspective: 1000;
            -moz-perspective: 1000;
            -ms-perspective: 1000;
            perspective: 1000;
            -ms-transform: perspective(1000px);
            -moz-transform: perspective(1000px);
                -moz-transform-style: preserve-3d; 
                -ms-transform-style: preserve-3d; 
            border: 1px solid #ccc;
        }
        /*
        .flip-container:hover .flipper, .flip-container.hover .flipper, #flip-toggle.flip .flipper {
            -webkit-transform: rotateY(180deg);
            -moz-transform: rotateY(180deg);
            -ms-transform: rotateY(180deg);
            transform: rotateY(180deg);
            filter: FlipH;
            -ms-filter: "FlipH";
        }
        */
        /* START: Accommodating for IE */
        .flip-container:hover .back, .flip-container.hover .back {
            -webkit-transform: rotateY(0deg);
            -moz-transform: rotateY(0deg);
            -o-transform: rotateY(0deg);
            -ms-transform: rotateY(0deg);
            transform: rotateY(0deg);
        }
        .flip-container:hover .front, .flip-container.hover .front {
             -webkit-transform: rotateY(180deg);
             -moz-transform: rotateY(180deg);
             -o-transform: rotateY(180deg);
             transform: rotateY(180deg);
        }
        
        /* END: Accommodating for IE */
        .flip-container, .front, .back {
            width: 320px;
            height: 427px;
        }
        .flipper {
            -webkit-transition: 0.6s;
            -webkit-transform-style: preserve-3d;
            -ms-transition: 0.6s;
            -moz-transition: 0.6s;
            -moz-transform: perspective(1000px);
            -moz-transform-style: preserve-3d;
            -ms-transform-style: preserve-3d;
            transition: 0.6s;
            transform-style: preserve-3d;
            position: relative;
        }
        .front, .back {
             -webkit-backface-visibility: hidden;
             -moz-backface-visibility: hidden;
             -ms-backface-visibility: hidden;
             backface-visibility: hidden;
            -webkit-transition: 0.6s;
            -webkit-transform-style: preserve-3d;
            -webkit-transform: rotateY(0deg);
            -moz-transition: 0.6s;
            -moz-transform-style: preserve-3d;
            -moz-transform: rotateY(0deg);
            -o-transition: 0.6s;
            -o-transform-style: preserve-3d;
            -o-transform: rotateY(0deg);
            -ms-transition: 0.6s;
            -ms-transform-style: preserve-3d;
            -ms-transform: rotateY(0deg);
            transition: 0.6s;
            transform-style: preserve-3d;
            transform: rotateY(0deg);
            position: absolute;
            top: 0;
            left: 0;
        }
        .front {
            -webkit-transform: rotateY(0deg);
            -ms-transform: rotateY(0deg);
            background: lightgreen;
            z-index: 2;
        }
        .back {
            background: lightblue;
            -webkit-transform: rotateY(-180deg);
            -moz-transform: rotateY(-180deg);
            -o-transform: rotateY(-180deg);
            -ms-transform: rotateY(-180deg);
            transform: rotateY(-180deg);
        }
        .front .name {
            font-size: 2em;
            display: inline-block;
            background: rgba(33, 33, 33, 0.9);
            color: #f8f8f8;
            font-family: Courier;
            padding: 5px 10px;
            border-radius: 5px;
            bottom: 60px;
            left: 25%;
            position: absolute;
            text-shadow: 0.1em 0.1em 0.05em #333;
            display: none;
            -webkit-transform: rotate(-20deg);
            -moz-transform: rotate(-20deg);
            -ms-transform: rotate(-20deg);
            transform: rotate(-20deg);
        }
        .back-logo {
            position: absolute;
            top: 40px;
            left: 90px;
            width: 160px;
            height: 117px;
            background: url(logo.png) 0 0 no-repeat;
        }
        .back-title {
            font-weight: bold;
            color: #00304a;
            position: absolute;
            top: 180px;
            left: 0;
            right: 0;
            text-align: center;
            text-shadow: 0.1em 0.1em 0.05em #acd7e5;
            font-family: Courier;
            font-size: 22px;
        }
        .back p {
            position: absolute;
            bottom: 40px;
            left: 0;
            right: 0;
            text-align: center;
            padding: 0 20px;
            font-size: 18px;
        }
        /* vertical */
        .vertical.flip-container {
            position: relative;
        }
        .vertical .back {
            -webkit-transform: rotateX(180deg);
            -moz-transform: rotateX(180deg);
            -ms-transform: rotateX(180deg);
            transform: rotateX(180deg);
        }
        .vertical.flip-container .flipper {
            -webkit-transform-origin: 100% 213.5px;
            -moz-transform-origin: 100% 213.5px;
            -ms-transform-origin: 100% 213.5px;
            transform-origin: 100% 213.5px;
        }
        /*
        .vertical.flip-container:hover .flipper {
            -webkit-transform: rotateX(-180deg);
            -moz-transform: rotateX(-180deg);
            -ms-transform: rotateX(-180deg);
            transform: rotateX(-180deg);
        }
        */
        /* START: Accommodating for IE */
        .vertical.flip-container:hover .back, .vertical.flip-container.hover .back {
            -webkit-transform: rotateX(0deg);
            -moz-transform: rotateX(0deg);
            -o-transform: rotateX(0deg);
            -ms-transform: rotateX(0deg);
            transform: rotateX(0deg);
        }
        .vertical.flip-container:hover .front, .vertical.flip-container.hover .front {
            -webkit-transform: rotateX(180deg);
            -moz-transform: rotateX(180deg);
            -o-transform: rotateX(180deg);
            transform: rotateX(180deg);
        }
    /* END: Accommodating for IE */
</style>
<div class="flip-container" ontouchstart="this.classList.toggle('hover');">
    <div class="flipper">
        <div class="front"><br /></div><div class="front"><br /></div><div class="front"><br /></div><div class="front">
            front
        </div>
        <div class="back">
            back
        </div>
    </div>
</div>
 
 
 
cs


Posted by JunkMam
,

webM은 일반적으로 데이터를 보는게 불가능한 것 같다.

그래서 프로그램을 사용해야되는데, ffprobe라는 걸 이용하면 된다.

ffprobe를 이용해서 데이터를 얻을 수 있다.[각주:1]


예)

ffprobe.exe -show_streams "input file"


이렇게 하면, 다음과 같은 형태를 얻을 수 있게 된다.


ffprobe version N-75185-gf58e011 Copyright (c) 2007-2015 the FFmpeg developers  built with gcc 4.9.3 (GCC)

  configuration: --enable-gpl --enable-version3 --disable-w32threads --enable-avisynth --enable-bzlib --enable-fontconfig --enable-frei0r --enable-gnutls --enable-iconv --enable-libass --enable-libbluray --enable-libbs2b --enable-libcaca --enable-libdcadec --enable-libfreetype --enable-libgme --enable-libgsm --enable-libilbc --enable-libmodplug --enable-libmp3lame --enable-libopencore-amrnb --enable-libopencore-amrwb --enable-libopenjpeg --enable-libopus --enable-librtmp --enable-libschroedinger --enable-libsoxr --enable-libspeex --enable-libtheora --enable-libtwolame --enable-libvidstab --enable-libvo-aacenc --enable-libvo-amrwbenc --enable-libvorbis --enable-libvpx --enable-libwavpack --enable-libwebp --enable-libx264 --enable-libx265 --enable-libxavs --enable-libxvid --enable-lzma --enable-decklink --enable-opencl --enable-zlib

  libavutil      55.  2.100 / 55.  2.100

  libavcodec     57.  1.100 / 57.  1.100

  libavformat    57.  0.100 / 57.  0.100

  libavdevice    57.  0.100 / 57.  0.100

  libavfilter     6.  1.100 /  6.  1.100

  libswscale      4.  0.100 /  4.  0.100

  libswresample   2.  0.100 /  2.  0.100

  libpostproc    54.  0.100 / 54.  0.100

Input #0, mov,mp4,m4a,3gp,3g2,mj2, from '.\moveCap.mp4':

  Metadata:

    major_brand     : isom

    minor_version   : 512

    compatible_brands: isomiso2avc1mp41

    encoder         : Lavf57.0.100

  Duration: 00:01:00.00, start: 0.040998, bitrate: 3498 kb/s

    Stream #0:0(eng): Video: h264 (High) (avc1 / 0x31637661), yuv420p, 800x600 [SAR 1:1 DAR 4:3], 3512 kb/s, 23.81 fps, 60 tbr, 48k tbn, 50 tbc (default)

    Metadata:

      handler_name    : VideoHandler

    Stream #0:1(eng): Audio: aac (LC) (mp4a / 0x6134706D), 22050 Hz, stereo, fltp, 94 kb/s (default)

    Metadata:

      handler_name    : SoundHandler

[STREAM]

index=0

codec_name=h264

codec_long_name=H.264 / AVC / MPEG-4 AVC / MPEG-4 part 10

profile=High

codec_type=video

codec_time_base=1/50

codec_tag_string=avc1

codec_tag=0x31637661

width=800

height=600

coded_width=800

coded_height=608

has_b_frames=0

sample_aspect_ratio=1:1

display_aspect_ratio=4:3

pix_fmt=yuv420p

level=40

color_range=N/A

color_space=unknown

color_transfer=unknown

color_primaries=unknown

chroma_location=left

timecode=N/A

refs=1

is_avc=1

nal_length_size=4

id=N/A

r_frame_rate=60/1

avg_frame_rate=86375/3628

time_base=1/48000

start_pts=94752

start_time=1.974000

duration_ts=2786304

duration=58.048000

bit_rate=3512905

max_bit_rate=N/A

bits_per_raw_sample=8

nb_frames=1382

nb_read_frames=N/A

nb_read_packets=N/A

DISPOSITION:default=1

DISPOSITION:dub=0

DISPOSITION:original=0

DISPOSITION:comment=0

DISPOSITION:lyrics=0

DISPOSITION:karaoke=0

DISPOSITION:forced=0

DISPOSITION:hearing_impaired=0

DISPOSITION:visual_impaired=0

DISPOSITION:clean_effects=0

DISPOSITION:attached_pic=0

TAG:language=eng

TAG:handler_name=VideoHandler

[/STREAM]

[STREAM]

index=1

codec_name=aac

codec_long_name=AAC (Advanced Audio Coding)

profile=LC

codec_type=audio

codec_time_base=1/22050

codec_tag_string=mp4a

codec_tag=0x6134706d

sample_fmt=fltp

sample_rate=22050

channels=2

channel_layout=stereo

bits_per_sample=0

id=N/A

r_frame_rate=0/0

avg_frame_rate=0/0

time_base=1/22050

start_pts=904

start_time=0.040998

duration_ts=1323007

duration=60.000317

bit_rate=94706

max_bit_rate=128000

bits_per_raw_sample=N/A

nb_frames=1292

nb_read_frames=N/A

nb_read_packets=N/A

DISPOSITION:default=1

DISPOSITION:dub=0

DISPOSITION:original=0

DISPOSITION:comment=0

DISPOSITION:lyrics=0

DISPOSITION:karaoke=0

DISPOSITION:forced=0

DISPOSITION:hearing_impaired=0

DISPOSITION:visual_impaired=0

DISPOSITION:clean_effects=0

DISPOSITION:attached_pic=0

TAG:language=eng

TAG:handler_name=SoundHandler

[/STREAM]


'연습' 카테고리의 다른 글

OpenCL 프로그래밍 공부 -시작-  (0) 2015.10.02
CSS3 -3D Flip Animation-  (0) 2015.09.30
ffmpeg 사용 -mp4 to webm convert(mp4을 webm으로 변환)-  (0) 2015.09.29
ffmpeg -이미지 추출-  (0) 2015.09.28
ffmpeg -동영상 자르기-  (0) 2015.09.28
Posted by JunkMam
,

mp4를 webm으로 변환시키는 방법이 있다.


mp4 -> webM 변환 사이트


하지만, ffmpeg을 사용해도 간단하게 변환이 가능하다.


예)[각주:1]

./ffmpeg -i input-file.mp4 -c:v libvpx -crf 10 -b:v 1M -c:a libvorbis output-file.webm


-c:a : 오디오 인코딩용 라이브러리

-b:v : 버퍼속도(비트 속도)

-crf : bit-rate 설정 인걸로 추정.

-c:v : 오디오 인코딩용 라이브러리


그 외

-buffsize : 평균 bit rate을 설정한다.


libvpx와 libvorbis을 라이브러리로 연결해서 webm으로 변환 시키는 작업을 한다.(vp8형 소스가 나온다.)


vp9형으로 변경할려면, 다음과 같이 하면 된다고 나와있다.


예)[각주:2]

ffmpeg -i input.mp4 -c:v libvpx-vp9 -b:v 1M -c:a libvorbis output.webm


libvpx-vp라이브러리명. 이런 차이가 있다.


음성 제거 방법은 

-an을 붙이면 된다.

Posted by JunkMam
,

ffmpeg -이미지 추출-

연습 2015. 9. 28. 19:31


ffmpeg를 이용하면, 


ffmpeg사이트


./ffmpeg -i 추출할 영상.mp4 -an -r 1 -y -s 가로x세로 추출할 이미지명.png


-an : 오디오 무시

-r : 1초당 몇 프레임 추출할 것인지 설정.

-y : 같은 이름 있을시 덮어 쓰기.

-s : 추출될 이미지 사이즈 설정.


이미지 명에 %d을 이용하면, 정수로 해당 이미지 갯수가 정수로 출력된다.

Posted by JunkMam
,

ffmpeg을 이용해서 mp4등 영상 파일을 자를 수 있다.


ffmpeg사이트


여기서 ffmpeg을 구한 후에 다음과 같이 사용하면 된다.


 .\ffmpeg.exe -i .\자를 영상.mp4 -ss 53 -t 300 -vcodec copy -acodec copy 잘린 영상.mp4


-ss : 초단위로 자를 위치 설정.

-t : 초단위로 자를 량 설정.

-vcodec copy : 비디오 코덱 카피

-acodec copy : 오디오 코덱 카피


이렇게 사용하면 된다.

Posted by JunkMam
,
Your browser does not support the HTML5 canvas tag.

 공식
 h=(물체의 높이)
 M=(물체의 폭)
 y=(물체와 시점간의 거리)
 H=(물체와 시점간의 거리에 보이는 높이)

 x축의 거리는 
 x=(y*M*cos(q))/(y+M*sin(q))

 높이는 h을 계산하는건,
 h=H(√x^2+y^2)/(√y^2+2yMsin(q)+M^2)


-SRC-
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
<div id="content" style="width:630px; overflow:hidden;color:#333333;">
                                <canvas id="myCanvas" width="200" height="200" style="border:1px solid #d3d3d3;">
            Your browser does not support the HTML5 canvas tag.</canvas>
 
        <script>
        
            var x,y;
            
            function draws(){
                ctx.beginPath();
 
                ctx.clearRect(0,0,c.width, c.height);
 
                calcX=((line*(heights/2)*cos)/(line+(heights/2)*sin));
 
                calcY=heights/2;
                calcY=calcY*Math.sqrt(calcX*calcX+line*line);
                calcY=calcY/Math.sqrt(Math.pow(line,2)+(((2*line)*(rec/2))*sin)+Math.pow(rec/2,2));
 
                ctx.moveTo((c.width/2)-calcX,(c.height/2)-calcY);
 
                Thetas=(-Thetas);
 
                sin=Math.sin(Thetas),cos=Math.cos(Thetas);
 
                calcX=((line*(heights/2)*cos)/(line+(heights/2)*sin));
 
                calcY=heights/2;
                calcY=calcY*Math.sqrt(calcX*calcX+line*line);
                calcY=calcY/Math.sqrt(Math.pow(line,2)+(((2*line)*(rec/2))*sin)+Math.pow(rec/2,2));
 
                ctx.lineTo((c.width/2)+calcX,(c.height/2)-calcY);
                ctx.lineTo((c.width/2)+calcX,(c.height/2));
                ctx.lineTo((c.width/2)+calcX,(c.height/2)+calcY);
 
                Thetas=(-Thetas);
                sin=Math.sin(Thetas),cos=Math.cos(Thetas);
 
                calcX=((line*(heights/2)*cos)/(line+(heights/2)*sin));
 
                calcY=heights/2;
                calcY=calcY*Math.sqrt(calcX*calcX+line*line);
                calcY=calcY/Math.sqrt(Math.pow(line,2)+(((2*line)*(rec/2))*sin)+Math.pow(rec/2,2));
 
                ctx.lineTo((c.width/2)-calcX,(c.height/2)+calcY);
                ctx.lineTo((c.width/2)-calcX,(c.height/2));
                ctx.lineTo((c.width/2)-calcX,(c.height/2)-calcY);
 
                ctx.stroke();
 
            }
 
            var c=document.getElementById("myCanvas");
            var ctx=c.getContext("2d");
            ctx.lineWidth="2";
 
            var rec=c.height;
            var line=400;
            var heights=(rec*c.height)/line;
 
            var theta=90;
            var Thetas=Math.PI/180*theta;
            var sin=Math.sin(Thetas),cos=Math.cos(Thetas);
 
            var calcX, calcY;
 
            var centX,centY;
 
            c.addEventListener("mousedown",dragstart,false);
 
            centX=0;
            centY=line;
            
            setTimeout(ani,100);
            
            function ani(){
                theta=(theta+1)%180;
                Thetas=Math.PI/180*theta;
                draws();
                setTimeout(ani,10);
            }
            
            function dragstart(event){
                x=event.x;
                y=event.y;
                event.target.removeEventListener("mousedown",dragstart,false);
                event.target.addEventListener("mousemove",drag,false);
                event.target.addEventListener("mouseup",dragend,false);
            }
 
            function drag(event){
 
                Thetas=(Math.asin(event.x/Math.sqrt(Math.pow(event.x,2)+Math.pow(event.y,2)))-Math.asin(x/Math.sqrt(Math.pow(x,2)+Math.pow(y,2))));
 
                document.getElementById("text").innerHTML=(Math.asin(event.x/Math.sqrt(Math.pow(event.x,2)+Math.pow(event.y,2)))-Math.asin(x/Math.sqrt(Math.pow(x,2)+Math.pow(y,2))));
 
                draws();
 
            }
 
            function dragend(event){
                event.target.removeEventListener("mousemove",drag,false);
                event.target.removeEventListener("mouseup",dragend,false);
                event.target.addEventListener("mousedown",dragstart,false);
            }
 
        </script>
cs



'연습' 카테고리의 다른 글

ffmpeg -이미지 추출-  (0) 2015.09.28
ffmpeg -동영상 자르기-  (0) 2015.09.28
PAQ8o10t  (0) 2015.06.10
void_Linked_List 전체 소스  (0) 2015.06.08
void_Linked_List 구현 -delFront 구현-  (0) 2015.06.06
Posted by JunkMam
,

PAQ8o10t

연습 2015. 6. 10. 00:20

PAQ8o10t


압축률이 높은 PAQ는 무손실 압축 방식을 사용하는 압축 프로그램이다.


시간/메모리는 효율성은 떨어지나, 압축률은 극한으로 올린 프로그램이라고 보면 된다.


산술 코딩으로 인하여, 메모리 사용량이 증가한다는 문제점이 있다.


[각주:1]

 Program

Compressed

size (bytes) 

% of orignal

size 

Compression

time (s) 

Memory (MiB)

PAQ8HP8 

133,423,109 

13.34 

64639 

1849 

PPMd 

183,876,014 

18.4 

880 

256 

bzip2 

254,007,875 

25.4 

379 

InfoZIP 

322,649,703 

32.26 

104 

0.1 


PAQ에서도 차이점이 있다.


[각주:2] PAQ에 대한 자료

PAQ.pdf


실행 파일

paq8o10t.exe


  1. [참조] PAQ - Wiki https://en.wikipedia.org/wiki/PAQ (2015-06-10) [본문으로]
  2. http://tcs.rwth-aachen.de/lehre/Komprimierung/SS2012/ausarbeitungen/PAQ.pdf (2015-06-10) [본문으로]
Posted by JunkMam
,

void_Linked_List 구현 내용.



voidList.h

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
/**
*/
#include <stdio.h>
#include <stdlib.h>
 
/**
*/
struct _void_node{
    char v_size;
    void* dats;
    struct _void_node* next;
};
 
/**
*/
int addFront(struct _void_node**void*char);
int delFtont(struct _void_node**void*);
 
 
cs


voidList.c

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
 
/**
*/
#include "voidList.h"
 
/**
*/
int addFront(struct _void_node** lp, void* dats, char v_size){
 
    int n = 0;
    struct _void_node* tmplp = NULL;
    printf("lp Test : %d\n"*lp);
 
    tmplp = (struct _void_node*)malloc(sizeof(struct _void_node));
 
    if(tmplp == NULL){
        return 1;
    }
 
    tmplp->v_size = v_size;
 
    tmplp->dats = NULL;
 
    tmplp->dats = malloc(sizeof(v_size));
 
    if(tmplp->dats == NULL){
        return 1;
    }
 
    for(n = 0; n < v_size; n++){
        *(char*)(tmplp->dats+n) = *(char*)(dats+n);
    }
 
    tmplp->next = *lp;
    *lp = tmplp;
 
    return 0;
}
 
/**
*/
int delFtont(struct _void_node** lp, void* dats){
 
    int n = 0;
    struct _void_node *tmplp=NULL;
 
    if(*lp==NULL){
        printf("Error lp is NULL");
        return 1;
    }
 
    tmplp = *lp;
 
    for(n=0;n<tmplp->v_size;n++){
        *(char*)dats = *(char*)tmplp->dats;
    }
 
    *lp=(*lp)->next;
 
    free(tmplp->dats);
    free(tmplp);
 
    return 0;
}
 
cs


main.c

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
#include <stdio.h>
#include <stdlib.h>
 
#include "voidList.h"
 
int main()
{
    struct _void_node* lp = NULL;
    int a=10,b=1;
 
    printf("Test %d\n", lp);
 
    addFront(&lp,&a,1);
 
    printf("Test %d\n", lp);
 
    addFront(&lp,&a,1);
 
    printf("Test %d\n", lp);
 
    system("pause");
 
    delFtont(&lp,&b);
 
    printf("Test %d\n", lp);
 
    delFtont(&lp,&b);
 
    printf("Test %d\n", lp);
 
    system("pause");
 
    return 0;
}
 
cs


이렇게 해서 문제 유무를 확인 해봤다.

free가 이상있는지는 모르겠다.

Posted by JunkMam
,