diff mbox series

[FFmpeg-devel] avformat/smoothstreamingenc: Move buffers to the end of structs

Message ID AM7PR03MB6660A044A78964A28351F8F58F6A9@AM7PR03MB6660.eurprd03.prod.outlook.com
State Accepted
Commit 228b25ad9bfef62338417fe607826dd33163ca69
Headers show
Series [FFmpeg-devel] avformat/smoothstreamingenc: Move buffers to the end of structs
Related show

Checks

Context Check Description
andriy/make_x86 success Make finished
andriy/make_fate_x86 success Make fate finished
andriy/make_ppc success Make finished
andriy/make_fate_ppc success Make fate finished

Commit Message

Andreas Rheinhardt Dec. 3, 2021, 10:49 p.m. UTC
This reduces codesize because the offsets of commonly used elements
are now smaller and thus need less bytes to encode in ptr+offset
addressing modes (with GCC 11.2 on x64: 0x1b8b -> 0x1a7b).

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
---
 libavformat/smoothstreamingenc.c | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

Comments

Andreas Rheinhardt Dec. 5, 2021, 11:36 a.m. UTC | #1
Andreas Rheinhardt:
> This reduces codesize because the offsets of commonly used elements
> are now smaller and thus need less bytes to encode in ptr+offset
> addressing modes (with GCC 11.2 on x64: 0x1b8b -> 0x1a7b).
> 
> Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
> ---
>  libavformat/smoothstreamingenc.c | 8 ++++----
>  1 file changed, 4 insertions(+), 4 deletions(-)
> 
> diff --git a/libavformat/smoothstreamingenc.c b/libavformat/smoothstreamingenc.c
> index 27b59c299c..ab0920c16f 100644
> --- a/libavformat/smoothstreamingenc.c
> +++ b/libavformat/smoothstreamingenc.c
> @@ -40,17 +40,15 @@
>  #include "libavutil/intreadwrite.h"
>  
>  typedef struct Fragment {
> -    char file[1024];
> -    char infofile[1024];
>      int64_t start_time, duration;
>      int n;
>      int64_t start_pos, size;
> +    char file[1024];
> +    char infofile[1024];
>  } Fragment;
>  
>  typedef struct OutputStream {
>      AVFormatContext *ctx;
> -    char dirname[1024];
> -    uint8_t iobuf[32768];
>      URLContext *out;  // Current output stream where all output is written
>      URLContext *out2; // Auxiliary output stream where all output is also written
>      URLContext *tail_out; // The actual main output stream, if we're currently seeked back to write elsewhere
> @@ -64,6 +62,8 @@ typedef struct OutputStream {
>      char *private_str;
>      int packet_size;
>      int audio_tag;
> +    char dirname[1024];
> +    uint8_t iobuf[32768];
>  } OutputStream;
>  
>  typedef struct SmoothStreamingContext {
> 

Will apply this patchset tonight unless there are objections.

- Andreas
diff mbox series

Patch

diff --git a/libavformat/smoothstreamingenc.c b/libavformat/smoothstreamingenc.c
index 27b59c299c..ab0920c16f 100644
--- a/libavformat/smoothstreamingenc.c
+++ b/libavformat/smoothstreamingenc.c
@@ -40,17 +40,15 @@ 
 #include "libavutil/intreadwrite.h"
 
 typedef struct Fragment {
-    char file[1024];
-    char infofile[1024];
     int64_t start_time, duration;
     int n;
     int64_t start_pos, size;
+    char file[1024];
+    char infofile[1024];
 } Fragment;
 
 typedef struct OutputStream {
     AVFormatContext *ctx;
-    char dirname[1024];
-    uint8_t iobuf[32768];
     URLContext *out;  // Current output stream where all output is written
     URLContext *out2; // Auxiliary output stream where all output is also written
     URLContext *tail_out; // The actual main output stream, if we're currently seeked back to write elsewhere
@@ -64,6 +62,8 @@  typedef struct OutputStream {
     char *private_str;
     int packet_size;
     int audio_tag;
+    char dirname[1024];
+    uint8_t iobuf[32768];
 } OutputStream;
 
 typedef struct SmoothStreamingContext {