Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
F
FFmpeg
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Container Registry
Model registry
Operate
Environments
Monitor
Incidents
Service Desk
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
libremedia
Tethys
FFmpeg
Commits
e745dc2d
Commit
e745dc2d
authored
11 years ago
by
Paul B Mahol
Browse files
Options
Downloads
Patches
Plain Diff
avcodec/dpx: refactor pixel format selection
Signed-off-by:
Paul B Mahol
<
onemda@gmail.com
>
parent
b8866783
No related branches found
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
libavcodec/dpx.c
+38
-12
38 additions, 12 deletions
libavcodec/dpx.c
with
38 additions
and
12 deletions
libavcodec/dpx.c
+
38
−
12
View file @
e745dc2d
...
@@ -162,11 +162,6 @@ static int decode_frame(AVCodecContext *avctx,
...
@@ -162,11 +162,6 @@ static int decode_frame(AVCodecContext *avctx,
switch
(
bits_per_color
)
{
switch
(
bits_per_color
)
{
case
8
:
case
8
:
if
(
elements
==
4
)
{
avctx
->
pix_fmt
=
AV_PIX_FMT_RGBA
;
}
else
{
avctx
->
pix_fmt
=
AV_PIX_FMT_RGB24
;
}
total_size
=
avctx
->
width
*
avctx
->
height
*
elements
;
total_size
=
avctx
->
width
*
avctx
->
height
*
elements
;
break
;
break
;
case
10
:
case
10
:
...
@@ -174,7 +169,6 @@ static int decode_frame(AVCodecContext *avctx,
...
@@ -174,7 +169,6 @@ static int decode_frame(AVCodecContext *avctx,
av_log
(
avctx
,
AV_LOG_ERROR
,
"Packing to 32bit required
\n
"
);
av_log
(
avctx
,
AV_LOG_ERROR
,
"Packing to 32bit required
\n
"
);
return
-
1
;
return
-
1
;
}
}
avctx
->
pix_fmt
=
AV_PIX_FMT_GBRP10
;
total_size
=
(
avctx
->
width
*
elements
+
2
)
/
3
*
4
*
avctx
->
height
;
total_size
=
(
avctx
->
width
*
elements
+
2
)
/
3
*
4
*
avctx
->
height
;
break
;
break
;
case
12
:
case
12
:
...
@@ -182,15 +176,9 @@ static int decode_frame(AVCodecContext *avctx,
...
@@ -182,15 +176,9 @@ static int decode_frame(AVCodecContext *avctx,
av_log
(
avctx
,
AV_LOG_ERROR
,
"Packing to 16bit required
\n
"
);
av_log
(
avctx
,
AV_LOG_ERROR
,
"Packing to 16bit required
\n
"
);
return
-
1
;
return
-
1
;
}
}
avctx
->
pix_fmt
=
AV_PIX_FMT_GBRP12
;
total_size
=
2
*
avctx
->
width
*
avctx
->
height
*
elements
;
total_size
=
2
*
avctx
->
width
*
avctx
->
height
*
elements
;
break
;
break
;
case
16
:
case
16
:
if
(
endian
)
{
avctx
->
pix_fmt
=
elements
==
4
?
AV_PIX_FMT_RGBA64BE
:
AV_PIX_FMT_RGB48BE
;
}
else
{
avctx
->
pix_fmt
=
elements
==
4
?
AV_PIX_FMT_RGBA64LE
:
AV_PIX_FMT_RGB48LE
;
}
total_size
=
2
*
avctx
->
width
*
avctx
->
height
*
elements
;
total_size
=
2
*
avctx
->
width
*
avctx
->
height
*
elements
;
break
;
break
;
case
1
:
case
1
:
...
@@ -202,6 +190,44 @@ static int decode_frame(AVCodecContext *avctx,
...
@@ -202,6 +190,44 @@ static int decode_frame(AVCodecContext *avctx,
return
AVERROR_INVALIDDATA
;
return
AVERROR_INVALIDDATA
;
}
}
switch
(
1000
*
descriptor
+
10
*
bits_per_color
+
endian
)
{
case
50081
:
case
50080
:
avctx
->
pix_fmt
=
AV_PIX_FMT_RGB24
;
break
;
case
51081
:
case
51080
:
avctx
->
pix_fmt
=
AV_PIX_FMT_RGBA
;
break
;
case
50100
:
case
51100
:
case
50101
:
case
51101
:
avctx
->
pix_fmt
=
AV_PIX_FMT_GBRP10
;
break
;
case
50120
:
case
51120
:
case
50121
:
case
51121
:
avctx
->
pix_fmt
=
AV_PIX_FMT_GBRP12
;
break
;
case
50161
:
avctx
->
pix_fmt
=
AV_PIX_FMT_RGB48BE
;
break
;
case
50160
:
avctx
->
pix_fmt
=
AV_PIX_FMT_RGB48LE
;
break
;
case
51161
:
avctx
->
pix_fmt
=
AV_PIX_FMT_RGBA64BE
;
break
;
case
51160
:
avctx
->
pix_fmt
=
AV_PIX_FMT_RGBA64LE
;
break
;
default:
av_log
(
avctx
,
AV_LOG_ERROR
,
"Unsupported format
\n
"
);
return
AVERROR_PATCHWELCOME
;
}
if
((
ret
=
ff_get_buffer
(
avctx
,
p
,
0
))
<
0
)
if
((
ret
=
ff_get_buffer
(
avctx
,
p
,
0
))
<
0
)
return
ret
;
return
ret
;
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment