Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Contribute to GitLab
Sign in / Register
Toggle navigation
F
ffmpeg.wasm-core
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Linshizhi
ffmpeg.wasm-core
Commits
d509ae5b
Commit
d509ae5b
authored
Dec 13, 2013
by
Vittorio Giovara
Committed by
Diego Biurrun
Feb 04, 2014
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
jvdec: K&R formatting cosmetics
Signed-off-by:
Diego Biurrun
<
diego@biurrun.de
>
parent
1f097d16
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
49 additions
and
43 deletions
+49
-43
jvdec.c
libavcodec/jvdec.c
+25
-21
jvdec.c
libavformat/jvdec.c
+24
-22
No files found.
libavcodec/jvdec.c
View file @
d509ae5b
...
...
@@ -25,11 +25,12 @@
* @author Peter Ross <pross@xvid.org>
*/
#include "libavutil/intreadwrite.h"
#include "avcodec.h"
#include "dsputil.h"
#include "get_bits.h"
#include "internal.h"
#include "libavutil/intreadwrite.h"
typedef
struct
JvContext
{
DSPContext
dsp
;
...
...
@@ -62,19 +63,19 @@ static inline void decode2x2(GetBitContext *gb, uint8_t *dst, int linesize)
case
1
:
v
[
0
]
=
get_bits
(
gb
,
8
);
for
(
j
=
0
;
j
<
2
;
j
++
)
memset
(
dst
+
j
*
linesize
,
v
[
0
],
2
);
memset
(
dst
+
j
*
linesize
,
v
[
0
],
2
);
break
;
case
2
:
v
[
0
]
=
get_bits
(
gb
,
8
);
v
[
1
]
=
get_bits
(
gb
,
8
);
for
(
j
=
0
;
j
<
2
;
j
++
)
for
(
i
=
0
;
i
<
2
;
i
++
)
dst
[
j
*
linesize
+
i
]
=
v
[
get_bits1
(
gb
)];
dst
[
j
*
linesize
+
i
]
=
v
[
get_bits1
(
gb
)];
break
;
case
3
:
for
(
j
=
0
;
j
<
2
;
j
++
)
for
(
i
=
0
;
i
<
2
;
i
++
)
dst
[
j
*
linesize
+
i
]
=
get_bits
(
gb
,
8
);
dst
[
j
*
linesize
+
i
]
=
get_bits
(
gb
,
8
);
}
}
...
...
@@ -89,29 +90,30 @@ static inline void decode4x4(GetBitContext *gb, uint8_t *dst, int linesize)
case
1
:
v
[
0
]
=
get_bits
(
gb
,
8
);
for
(
j
=
0
;
j
<
4
;
j
++
)
memset
(
dst
+
j
*
linesize
,
v
[
0
],
4
);
memset
(
dst
+
j
*
linesize
,
v
[
0
],
4
);
break
;
case
2
:
v
[
0
]
=
get_bits
(
gb
,
8
);
v
[
1
]
=
get_bits
(
gb
,
8
);
for
(
j
=
2
;
j
>=
0
;
j
-=
2
)
{
for
(
i
=
0
;
i
<
4
;
i
++
)
dst
[
j
*
linesize
+
i
]
=
v
[
get_bits1
(
gb
)];
dst
[
j
*
linesize
+
i
]
=
v
[
get_bits1
(
gb
)];
for
(
i
=
0
;
i
<
4
;
i
++
)
dst
[(
j
+
1
)
*
linesize
+
i
]
=
v
[
get_bits1
(
gb
)];
dst
[(
j
+
1
)
*
linesize
+
i
]
=
v
[
get_bits1
(
gb
)];
}
break
;
case
3
:
for
(
j
=
0
;
j
<
4
;
j
+=
2
)
for
(
i
=
0
;
i
<
4
;
i
+=
2
)
decode2x2
(
gb
,
dst
+
j
*
linesize
+
i
,
linesize
);
decode2x2
(
gb
,
dst
+
j
*
linesize
+
i
,
linesize
);
}
}
/**
* Decode 8x8 block
*/
static
inline
void
decode8x8
(
GetBitContext
*
gb
,
uint8_t
*
dst
,
int
linesize
,
DSPContext
*
dsp
)
static
inline
void
decode8x8
(
GetBitContext
*
gb
,
uint8_t
*
dst
,
int
linesize
,
DSPContext
*
dsp
)
{
int
i
,
j
,
v
[
2
];
...
...
@@ -125,17 +127,16 @@ static inline void decode8x8(GetBitContext *gb, uint8_t *dst, int linesize, DSPC
v
[
1
]
=
get_bits
(
gb
,
8
);
for
(
j
=
7
;
j
>=
0
;
j
--
)
for
(
i
=
0
;
i
<
8
;
i
++
)
dst
[
j
*
linesize
+
i
]
=
v
[
get_bits1
(
gb
)];
dst
[
j
*
linesize
+
i
]
=
v
[
get_bits1
(
gb
)];
break
;
case
3
:
for
(
j
=
0
;
j
<
8
;
j
+=
4
)
for
(
i
=
0
;
i
<
8
;
i
+=
4
)
decode4x4
(
gb
,
dst
+
j
*
linesize
+
i
,
linesize
);
decode4x4
(
gb
,
dst
+
j
*
linesize
+
i
,
linesize
);
}
}
static
int
decode_frame
(
AVCodecContext
*
avctx
,
void
*
data
,
int
*
got_frame
,
static
int
decode_frame
(
AVCodecContext
*
avctx
,
void
*
data
,
int
*
got_frame
,
AVPacket
*
avpkt
)
{
JvContext
*
s
=
avctx
->
priv_data
;
...
...
@@ -160,7 +161,8 @@ static int decode_frame(AVCodecContext *avctx,
for
(
j
=
0
;
j
<
avctx
->
height
;
j
+=
8
)
for
(
i
=
0
;
i
<
avctx
->
width
;
i
+=
8
)
decode8x8
(
&
gb
,
s
->
frame
->
data
[
0
]
+
j
*
s
->
frame
->
linesize
[
0
]
+
i
,
decode8x8
(
&
gb
,
s
->
frame
->
data
[
0
]
+
j
*
s
->
frame
->
linesize
[
0
]
+
i
,
s
->
frame
->
linesize
[
0
],
&
s
->
dsp
);
buf
+=
video_size
;
...
...
@@ -168,10 +170,12 @@ static int decode_frame(AVCodecContext *avctx,
if
(
buf
+
1
<=
buf_end
)
{
int
v
=
*
buf
++
;
for
(
j
=
0
;
j
<
avctx
->
height
;
j
++
)
memset
(
s
->
frame
->
data
[
0
]
+
j
*
s
->
frame
->
linesize
[
0
],
v
,
avctx
->
width
);
memset
(
s
->
frame
->
data
[
0
]
+
j
*
s
->
frame
->
linesize
[
0
],
v
,
avctx
->
width
);
}
}
else
{
av_log
(
avctx
,
AV_LOG_WARNING
,
"unsupported frame type %i
\n
"
,
video_type
);
av_log
(
avctx
,
AV_LOG_WARNING
,
"unsupported frame type %i
\n
"
,
video_type
);
return
AVERROR_INVALIDDATA
;
}
}
...
...
libavformat/jvdec.c
View file @
d509ae5b
...
...
@@ -27,6 +27,7 @@
#include "libavutil/channel_layout.h"
#include "libavutil/intreadwrite.h"
#include "avformat.h"
#include "internal.h"
...
...
@@ -106,7 +107,8 @@ static int read_header(AVFormatContext *s)
avio_skip
(
pb
,
10
);
ast
->
index_entries
=
av_malloc
(
ast
->
nb_index_entries
*
sizeof
(
*
ast
->
index_entries
));
ast
->
index_entries
=
av_malloc
(
ast
->
nb_index_entries
*
sizeof
(
*
ast
->
index_entries
));
if
(
!
ast
->
index_entries
)
return
AVERROR
(
ENOMEM
);
...
...
@@ -115,7 +117,7 @@ static int read_header(AVFormatContext *s)
return
AVERROR
(
ENOMEM
);
offset
=
0x68
+
ast
->
nb_index_entries
*
16
;
for
(
i
=
0
;
i
<
ast
->
nb_index_entries
;
i
++
)
{
for
(
i
=
0
;
i
<
ast
->
nb_index_entries
;
i
++
)
{
AVIndexEntry
*
e
=
ast
->
index_entries
+
i
;
JVFrame
*
jvf
=
jv
->
frames
+
i
;
...
...
@@ -168,10 +170,10 @@ static int read_packet(AVFormatContext *s, AVPacket *pkt)
const
AVIndexEntry
*
e
=
ast
->
index_entries
+
jv
->
pts
;
const
JVFrame
*
jvf
=
jv
->
frames
+
jv
->
pts
;
switch
(
jv
->
state
)
{
switch
(
jv
->
state
)
{
case
JV_AUDIO
:
jv
->
state
++
;
if
(
jvf
->
audio_size
)
{
if
(
jvf
->
audio_size
)
{
if
(
av_get_packet
(
s
->
pb
,
pkt
,
jvf
->
audio_size
)
<
0
)
return
AVERROR
(
ENOMEM
);
pkt
->
stream_index
=
0
;
...
...
@@ -219,10 +221,10 @@ static int read_seek(AVFormatContext *s, int stream_index,
AVStream
*
ast
=
s
->
streams
[
0
];
int
i
;
if
(
flags
&
(
AVSEEK_FLAG_BYTE
|
AVSEEK_FLAG_FRAME
))
if
(
flags
&
(
AVSEEK_FLAG_BYTE
|
AVSEEK_FLAG_FRAME
))
return
AVERROR
(
ENOSYS
);
switch
(
stream_index
)
{
switch
(
stream_index
)
{
case
0
:
i
=
av_index_search_timestamp
(
ast
,
ts
,
flags
);
break
;
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment