FazBrowse GitHub Viewer
|
Trending
|
URL:
|
Home
Tools:
[Download Repo ZIP]
[View Raw Code]
[Original HTTPS Page]
ImageEncoder/VideoDecoder.cpp at master · ThenTech/ImageEncoder · GitHub
ThenTech
/
ImageEncoder
Public
Notifications
You must be signed in to change notification settings
Fork
0
Star
0
Code
Issues
0
Pull requests
0
Actions
Projects
Security and quality
0
Insights
Additional navigation options
Code
Issues
Pull requests
Actions
Projects
Security and quality
Insights
Expand file tree
Breadcrumbs
ImageEncoder
/
VideoDecoder.cpp
Copy path
More file actions
More file actions
Latest commit
History
History
History
66 lines (48 loc) · 2.04 KB
Breadcrumbs
ImageEncoder
/
VideoDecoder.cpp
Copy path
File metadata and controls
66 lines (48 loc) · 2.04 KB
Raw
Copy raw file
Download raw file
Open symbols panel
Edit and raw actions
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
#
include
"
VideoDecoder.hpp
"
#
include
"
main.hpp
"
#
include
"
Logger.hpp
"
#
include
<
cassert
>
dc::VideoDecoder::VideoDecoder
(
const
std::string &source_file,
const
std::string &dest_file,
const
bool
&motioncomp)
: VideoProcessor(source_file, dest_file, motioncomp)
{
//
Verify settings
assert
(
this
->
width
% dc::BlockSize ==
0
);
assert
(
this
->
height
% dc::BlockSize ==
0
);
//
Same data stats before decoding starts
const
float
hdrlen =
float
(
this
->
reader
->
get_position
()) /
8
.
0f
;
const
float
datlen =
float
(
this
->
reader
->
get_size
()) - hdrlen;
util::Logger::WriteLn
(
std::string_format
(
"
[VideoDecoder] Loaded %dx%d video with
"
"
%.1f bytes header and %.1f bytes data.
"
,
this
->
width
,
this
->
height
, hdrlen, datlen));
//
Create the output buffer
const
size_t
total_frame_size =
this
->
frame_buffer_size
+
this
->
frame_garbage_size
;
this
->
writer
= util::allocVar<util::BitStreamWriter>(total_frame_size *
this
->
frame_count
);
}
dc::VideoDecoder::~VideoDecoder
(
void
) {
//
Empty
}
bool
dc::VideoDecoder::process
(
void
) {
bool
success =
true
;
util::Logger::WriteLn
(
"
[VideoDecoder] Processing video...
"
);
success =
VideoProcessor::process
(
this
->
writer
->
get_buffer
());
const
size_t
frame_count =
this
->
frames
->
size
();
size_t
frameid =
0u
;
util::Logger::WriteLn
(
"
[VideoDecoder] Processing Frames...
"
);
util::Logger::WriteProgress
(
0
, frame_count);
for
(dc::Frame* f : *
this
->
frames
) {
util::Logger::Pause
();
f->
loadFromStream
(*
this
->
reader
,
this
->
motioncomp
);
f->
streamEncoded
(*
this
->
writer
);
util::Logger::Resume
();
util::Logger::WriteProgress
(++frameid, frame_count);
}
util::Logger::WriteLn
(
"
"
,
false
);
//
Buffer is written implicitly
this
->
writer
->
set_position
(
this
->
writer
->
get_size_bits
());
return
success;
}
void
dc::VideoDecoder::saveResult
(
void
)
const
{
VideoProcessor::saveResult
(
false
);
}
Back
|
FazBrowse Home
|
New Git URL