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
9e010b41
Commit
9e010b41
authored
17 years ago
by
Ivo van Poorten
Browse files
Options
Downloads
Patches
Plain Diff
add AV_[RW][BL]64 support
Originally committed as revision 8924 to
svn://svn.ffmpeg.org/ffmpeg/trunk
parent
5fd5d0ef
Branches
Branches containing commit
Tags
Tags containing commit
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
libavutil/intreadwrite.h
+54
-0
54 additions, 0 deletions
libavutil/intreadwrite.h
with
54 additions
and
0 deletions
libavutil/intreadwrite.h
+
54
−
0
View file @
9e010b41
...
...
@@ -31,6 +31,7 @@ struct unaligned_16 { uint16_t l; } __attribute__((packed));
#define ST16(a, b) (((struct unaligned_16 *) (a))->l) = (b)
#define ST32(a, b) (((struct unaligned_32 *) (a))->l) = (b)
#define ST64(a, b) (((struct unaligned_64 *) (a))->l) = (b)
#else
/* __GNUC__ */
...
...
@@ -40,6 +41,7 @@ struct unaligned_16 { uint16_t l; } __attribute__((packed));
#define ST16(a, b) *((uint16_t*)(a)) = (b)
#define ST32(a, b) *((uint32_t*)(a)) = (b)
#define ST64(a, b) *((uint64_t*)(a)) = (b)
#endif
/* !__GNUC__ */
...
...
@@ -129,4 +131,56 @@ struct unaligned_16 { uint16_t l; } __attribute__((packed));
((uint8_t*)(p))[3] = (d)>>24; }
#endif
#ifdef HAVE_FAST_UNALIGNED
# ifdef WORDS_BIGENDIAN
# define AV_RB64(x) LD64(x)
# define AV_WB64(p, d) ST64(p, d)
# define AV_RL64(x) bswap_64(LD64(x))
# define AV_WL64(p, d) ST64(p, bswap_64(d))
# else
/* WORDS_BIGENDIAN */
# define AV_RB64(x) bswap_64(LD64(x))
# define AV_WB64(p, d) ST64(p, bswap_64(d))
# define AV_RL64(x) LD64(x)
# define AV_WL64(p, d) ST64(p, d)
# endif
#else
/* HAVE_FAST_UNALIGNED */
#define AV_RB64(x) (((uint64_t)((uint8_t*)(x))[0] << 56) | \
((uint64_t)((uint8_t*)(x))[1] << 48) | \
((uint64_t)((uint8_t*)(x))[2] << 40) | \
((uint64_t)((uint8_t*)(x))[3] << 32) | \
((uint64_t)((uint8_t*)(x))[4] << 24) | \
((uint64_t)((uint8_t*)(x))[5] << 16) | \
((uint64_t)((uint8_t*)(x))[6] << 8) | \
(uint64_t)((uint8_t*)(x))[7])
#define AV_WB64(p, d) { \
((uint8_t*)(p))[7] = (d); \
((uint8_t*)(p))[6] = (d)>>8; \
((uint8_t*)(p))[5] = (d)>>16; \
((uint8_t*)(p))[4] = (d)>>24; \
((uint8_t*)(p))[3] = (d)>>32; \
((uint8_t*)(p))[2] = (d)>>40; \
((uint8_t*)(p))[1] = (d)>>48; \
((uint8_t*)(p))[0] = (d)>>56; }
#define AV_RL64(x) (((uint64_t)((uint8_t*)(x))[7] << 56) | \
((uint64_t)((uint8_t*)(x))[6] << 48) | \
((uint64_t)((uint8_t*)(x))[5] << 40) | \
((uint64_t)((uint8_t*)(x))[4] << 32) | \
((uint64_t)((uint8_t*)(x))[3] << 24) | \
((uint64_t)((uint8_t*)(x))[2] << 16) | \
((uint64_t)((uint8_t*)(x))[1] << 8) | \
(uint64_t)((uint8_t*)(x))[0])
#define AV_WL64(p, d) { \
((uint8_t*)(p))[0] = (d); \
((uint8_t*)(p))[1] = (d)>>8; \
((uint8_t*)(p))[2] = (d)>>16; \
((uint8_t*)(p))[3] = (d)>>24; \
((uint8_t*)(p))[4] = (d)>>32; \
((uint8_t*)(p))[5] = (d)>>40; \
((uint8_t*)(p))[6] = (d)>>48; \
((uint8_t*)(p))[7] = (d)>>56; }
#endif
#endif
/* INTREADWRITE_H */
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