Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
F
ffmpeg
Project
Project
Details
Activity
Releases
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
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Stefan Westerfeld
ffmpeg
Commits
3dafde0b
Commit
3dafde0b
authored
Apr 29, 2012
by
Carl Eugen Hoyos
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Simplify camstudio decoding and fix odd 16bit decoding.
Fixes ticket #1220.
parent
9f98a8e9
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
10 additions
and
105 deletions
+10
-105
cscd.c
libavcodec/cscd.c
+9
-104
version.h
libavcodec/version.h
+1
-1
No files found.
libavcodec/cscd.c
View file @
3dafde0b
...
@@ -35,9 +35,9 @@ typedef struct {
...
@@ -35,9 +35,9 @@ typedef struct {
unsigned
char
*
decomp_buf
;
unsigned
char
*
decomp_buf
;
}
CamStudioContext
;
}
CamStudioContext
;
static
void
copy_frame_default
(
AVFrame
*
f
,
const
uint8_t
*
src
,
int
src_stride
,
static
void
copy_frame_default
(
AVFrame
*
f
,
const
uint8_t
*
src
,
int
linelen
,
int
height
)
{
int
linelen
,
int
height
)
{
int
i
;
int
i
,
src_stride
=
FFALIGN
(
linelen
,
4
)
;
uint8_t
*
dst
=
f
->
data
[
0
];
uint8_t
*
dst
=
f
->
data
[
0
];
dst
+=
(
height
-
1
)
*
f
->
linesize
[
0
];
dst
+=
(
height
-
1
)
*
f
->
linesize
[
0
];
for
(
i
=
height
;
i
;
i
--
)
{
for
(
i
=
height
;
i
;
i
--
)
{
...
@@ -47,9 +47,9 @@ static void copy_frame_default(AVFrame *f, const uint8_t *src, int src_stride,
...
@@ -47,9 +47,9 @@ static void copy_frame_default(AVFrame *f, const uint8_t *src, int src_stride,
}
}
}
}
static
void
add_frame_default
(
AVFrame
*
f
,
const
uint8_t
*
src
,
int
src_stride
,
static
void
add_frame_default
(
AVFrame
*
f
,
const
uint8_t
*
src
,
int
linelen
,
int
height
)
{
int
linelen
,
int
height
)
{
int
i
,
j
;
int
i
,
j
,
src_stride
=
FFALIGN
(
linelen
,
4
)
;
uint8_t
*
dst
=
f
->
data
[
0
];
uint8_t
*
dst
=
f
->
data
[
0
];
dst
+=
(
height
-
1
)
*
f
->
linesize
[
0
];
dst
+=
(
height
-
1
)
*
f
->
linesize
[
0
];
for
(
i
=
height
;
i
;
i
--
)
{
for
(
i
=
height
;
i
;
i
--
)
{
...
@@ -60,81 +60,6 @@ static void add_frame_default(AVFrame *f, const uint8_t *src, int src_stride,
...
@@ -60,81 +60,6 @@ static void add_frame_default(AVFrame *f, const uint8_t *src, int src_stride,
}
}
}
}
#if !HAVE_BIGENDIAN
#define copy_frame_16(f, s, l, h) copy_frame_default(f, s, l, l, h)
#define copy_frame_32(f, s, l, h) copy_frame_default(f, s, l, l, h)
#define add_frame_16(f, s, l, h) add_frame_default(f, s, l, l, h)
#define add_frame_32(f, s, l, h) add_frame_default(f, s, l, l, h)
#else
static
void
copy_frame_16
(
AVFrame
*
f
,
const
uint8_t
*
src
,
int
linelen
,
int
height
)
{
int
i
,
j
;
uint8_t
*
dst
=
f
->
data
[
0
];
dst
+=
(
height
-
1
)
*
f
->
linesize
[
0
];
for
(
i
=
height
;
i
;
i
--
)
{
for
(
j
=
linelen
/
2
;
j
;
j
--
)
{
dst
[
0
]
=
src
[
1
];
dst
[
1
]
=
src
[
0
];
src
+=
2
;
dst
+=
2
;
}
dst
-=
f
->
linesize
[
0
]
+
linelen
;
}
}
static
void
copy_frame_32
(
AVFrame
*
f
,
const
uint8_t
*
src
,
int
linelen
,
int
height
)
{
int
i
,
j
;
uint8_t
*
dst
=
f
->
data
[
0
];
dst
+=
(
height
-
1
)
*
f
->
linesize
[
0
];
for
(
i
=
height
;
i
;
i
--
)
{
for
(
j
=
linelen
/
4
;
j
;
j
--
)
{
dst
[
0
]
=
src
[
3
];
dst
[
1
]
=
src
[
2
];
dst
[
2
]
=
src
[
1
];
dst
[
3
]
=
src
[
0
];
src
+=
4
;
dst
+=
4
;
}
dst
-=
f
->
linesize
[
0
]
+
linelen
;
}
}
static
void
add_frame_16
(
AVFrame
*
f
,
const
uint8_t
*
src
,
int
linelen
,
int
height
)
{
int
i
,
j
;
uint8_t
*
dst
=
f
->
data
[
0
];
dst
+=
(
height
-
1
)
*
f
->
linesize
[
0
];
for
(
i
=
height
;
i
;
i
--
)
{
for
(
j
=
linelen
/
2
;
j
;
j
--
)
{
dst
[
0
]
+=
src
[
1
];
dst
[
1
]
+=
src
[
0
];
src
+=
2
;
dst
+=
2
;
}
dst
-=
f
->
linesize
[
0
]
+
linelen
;
}
}
static
void
add_frame_32
(
AVFrame
*
f
,
const
uint8_t
*
src
,
int
linelen
,
int
height
)
{
int
i
,
j
;
uint8_t
*
dst
=
f
->
data
[
0
];
dst
+=
(
height
-
1
)
*
f
->
linesize
[
0
];
for
(
i
=
height
;
i
;
i
--
)
{
for
(
j
=
linelen
/
4
;
j
;
j
--
)
{
dst
[
0
]
+=
src
[
3
];
dst
[
1
]
+=
src
[
2
];
dst
[
2
]
+=
src
[
1
];
dst
[
3
]
+=
src
[
0
];
src
+=
4
;
dst
+=
4
;
}
dst
-=
f
->
linesize
[
0
]
+
linelen
;
}
}
#endif
static
int
decode_frame
(
AVCodecContext
*
avctx
,
void
*
data
,
int
*
data_size
,
static
int
decode_frame
(
AVCodecContext
*
avctx
,
void
*
data
,
int
*
data_size
,
AVPacket
*
avpkt
)
{
AVPacket
*
avpkt
)
{
const
uint8_t
*
buf
=
avpkt
->
data
;
const
uint8_t
*
buf
=
avpkt
->
data
;
...
@@ -185,32 +110,14 @@ static int decode_frame(AVCodecContext *avctx, void *data, int *data_size,
...
@@ -185,32 +110,14 @@ static int decode_frame(AVCodecContext *avctx, void *data, int *data_size,
if
(
buf
[
0
]
&
1
)
{
// keyframe
if
(
buf
[
0
]
&
1
)
{
// keyframe
c
->
pic
.
pict_type
=
AV_PICTURE_TYPE_I
;
c
->
pic
.
pict_type
=
AV_PICTURE_TYPE_I
;
c
->
pic
.
key_frame
=
1
;
c
->
pic
.
key_frame
=
1
;
switch
(
c
->
bpp
)
{
copy_frame_default
(
&
c
->
pic
,
c
->
decomp_buf
,
case
16
:
copy_frame_16
(
&
c
->
pic
,
c
->
decomp_buf
,
c
->
linelen
,
c
->
height
);
break
;
case
32
:
copy_frame_32
(
&
c
->
pic
,
c
->
decomp_buf
,
c
->
linelen
,
c
->
height
);
break
;
default:
copy_frame_default
(
&
c
->
pic
,
c
->
decomp_buf
,
FFALIGN
(
c
->
linelen
,
4
),
c
->
linelen
,
c
->
height
);
c
->
linelen
,
c
->
height
);
}
}
else
{
}
else
{
c
->
pic
.
pict_type
=
AV_PICTURE_TYPE_P
;
c
->
pic
.
pict_type
=
AV_PICTURE_TYPE_P
;
c
->
pic
.
key_frame
=
0
;
c
->
pic
.
key_frame
=
0
;
switch
(
c
->
bpp
)
{
add_frame_default
(
&
c
->
pic
,
c
->
decomp_buf
,
case
16
:
add_frame_16
(
&
c
->
pic
,
c
->
decomp_buf
,
c
->
linelen
,
c
->
height
);
break
;
case
32
:
add_frame_32
(
&
c
->
pic
,
c
->
decomp_buf
,
c
->
linelen
,
c
->
height
);
break
;
default:
add_frame_default
(
&
c
->
pic
,
c
->
decomp_buf
,
FFALIGN
(
c
->
linelen
,
4
),
c
->
linelen
,
c
->
height
);
c
->
linelen
,
c
->
height
);
}
}
}
*
picture
=
c
->
pic
;
*
picture
=
c
->
pic
;
*
data_size
=
sizeof
(
AVFrame
);
*
data_size
=
sizeof
(
AVFrame
);
...
@@ -221,9 +128,9 @@ static av_cold int decode_init(AVCodecContext *avctx) {
...
@@ -221,9 +128,9 @@ static av_cold int decode_init(AVCodecContext *avctx) {
CamStudioContext
*
c
=
avctx
->
priv_data
;
CamStudioContext
*
c
=
avctx
->
priv_data
;
int
stride
;
int
stride
;
switch
(
avctx
->
bits_per_coded_sample
)
{
switch
(
avctx
->
bits_per_coded_sample
)
{
case
16
:
avctx
->
pix_fmt
=
PIX_FMT_RGB555
;
break
;
case
16
:
avctx
->
pix_fmt
=
PIX_FMT_RGB555
LE
;
break
;
case
24
:
avctx
->
pix_fmt
=
PIX_FMT_BGR24
;
break
;
case
24
:
avctx
->
pix_fmt
=
PIX_FMT_BGR24
;
break
;
case
32
:
avctx
->
pix_fmt
=
PIX_FMT_
RGB32
;
break
;
case
32
:
avctx
->
pix_fmt
=
PIX_FMT_
BGRA
;
break
;
default:
default:
av_log
(
avctx
,
AV_LOG_ERROR
,
av_log
(
avctx
,
AV_LOG_ERROR
,
"CamStudio codec error: invalid depth %i bpp
\n
"
,
"CamStudio codec error: invalid depth %i bpp
\n
"
,
...
@@ -235,9 +142,7 @@ static av_cold int decode_init(AVCodecContext *avctx) {
...
@@ -235,9 +142,7 @@ static av_cold int decode_init(AVCodecContext *avctx) {
c
->
pic
.
data
[
0
]
=
NULL
;
c
->
pic
.
data
[
0
]
=
NULL
;
c
->
linelen
=
avctx
->
width
*
avctx
->
bits_per_coded_sample
/
8
;
c
->
linelen
=
avctx
->
width
*
avctx
->
bits_per_coded_sample
/
8
;
c
->
height
=
avctx
->
height
;
c
->
height
=
avctx
->
height
;
stride
=
c
->
linelen
;
stride
=
FFALIGN
(
c
->
linelen
,
4
);
if
(
avctx
->
bits_per_coded_sample
==
24
)
stride
=
FFALIGN
(
stride
,
4
);
c
->
decomp_size
=
c
->
height
*
stride
;
c
->
decomp_size
=
c
->
height
*
stride
;
c
->
decomp_buf
=
av_malloc
(
c
->
decomp_size
+
AV_LZO_OUTPUT_PADDING
);
c
->
decomp_buf
=
av_malloc
(
c
->
decomp_size
+
AV_LZO_OUTPUT_PADDING
);
if
(
!
c
->
decomp_buf
)
{
if
(
!
c
->
decomp_buf
)
{
...
...
libavcodec/version.h
View file @
3dafde0b
...
@@ -28,7 +28,7 @@
...
@@ -28,7 +28,7 @@
#define LIBAVCODEC_VERSION_MAJOR 54
#define LIBAVCODEC_VERSION_MAJOR 54
#define LIBAVCODEC_VERSION_MINOR 17
#define LIBAVCODEC_VERSION_MINOR 17
#define LIBAVCODEC_VERSION_MICRO 10
0
#define LIBAVCODEC_VERSION_MICRO 10
1
#define LIBAVCODEC_VERSION_INT AV_VERSION_INT(LIBAVCODEC_VERSION_MAJOR, \
#define LIBAVCODEC_VERSION_INT AV_VERSION_INT(LIBAVCODEC_VERSION_MAJOR, \
LIBAVCODEC_VERSION_MINOR, \
LIBAVCODEC_VERSION_MINOR, \
...
...
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