Message ID | AM7PR03MB66609F2C56DC07388EA67C5F8FCD9@AM7PR03MB6660.eurprd03.prod.outlook.com |
---|---|
State | Accepted |
Commit | 0172deccc4e229e0b22f3e776f71e6e4b5a08e35 |
Headers | show |
Series | [FFmpeg-devel] avcodec/h264_levels, h265_profile_level: Avoid relocations | expand |
Context | Check | Description |
---|---|---|
andriy/commit_msg_x86 | warning | The first line of the commit message must start with a context terminated by a colon and a space, for example "lavu/opt: " or "doc: ". |
andriy/make_x86 | success | Make finished |
andriy/make_fate_x86 | success | Make fate finished |
andriy/commit_msg_ppc | warning | The first line of the commit message must start with a context terminated by a colon and a space, for example "lavu/opt: " or "doc: ". |
andriy/make_ppc | success | Make finished |
andriy/make_fate_ppc | success | Make fate finished |
Andreas Rheinhardt: > H.264 and H.265 levels' names are usually of the form "x" or "x.y" > with x and y being single digits; the one exception are the H.264 1b > levels. All of those levels' names fit into a char[4] and it is likely > that this future levels will do so, too. > > Therefore this commit changes the H26(4|5)LevelDescriptor structures > to use such a char [4] instead of a pointer to a const char. This makes > the structures smaller (when sizeof(char*) == 8) and avoids relocations, > thereby moving the corresponding arrays from .data.rel.ro into .rodata. > > Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com> > --- > libavcodec/h264_levels.h | 2 +- > libavcodec/h265_profile_level.h | 2 +- > 2 files changed, 2 insertions(+), 2 deletions(-) > > diff --git a/libavcodec/h264_levels.h b/libavcodec/h264_levels.h > index 6bba2e8624..310d79e51a 100644 > --- a/libavcodec/h264_levels.h > +++ b/libavcodec/h264_levels.h > @@ -23,7 +23,7 @@ > #include <stdint.h> > > typedef struct H264LevelDescriptor { > - const char *name; > + char name[4]; // Large enough for all current levels like "4.1" > uint8_t level_idc; > uint8_t constraint_set3_flag; > uint32_t max_mbps; > diff --git a/libavcodec/h265_profile_level.h b/libavcodec/h265_profile_level.h > index f1a11f51dc..cd30ac5c50 100644 > --- a/libavcodec/h265_profile_level.h > +++ b/libavcodec/h265_profile_level.h > @@ -25,7 +25,7 @@ > > > typedef struct H265LevelDescriptor { > - const char *name; > + char name[4]; // Large enough for all current levels like "4.1" > uint8_t level_idc; > > // Table A.6. > Will apply tomorrow unless there are objections. - Andreas
diff --git a/libavcodec/h264_levels.h b/libavcodec/h264_levels.h index 6bba2e8624..310d79e51a 100644 --- a/libavcodec/h264_levels.h +++ b/libavcodec/h264_levels.h @@ -23,7 +23,7 @@ #include <stdint.h> typedef struct H264LevelDescriptor { - const char *name; + char name[4]; // Large enough for all current levels like "4.1" uint8_t level_idc; uint8_t constraint_set3_flag; uint32_t max_mbps; diff --git a/libavcodec/h265_profile_level.h b/libavcodec/h265_profile_level.h index f1a11f51dc..cd30ac5c50 100644 --- a/libavcodec/h265_profile_level.h +++ b/libavcodec/h265_profile_level.h @@ -25,7 +25,7 @@ typedef struct H265LevelDescriptor { - const char *name; + char name[4]; // Large enough for all current levels like "4.1" uint8_t level_idc; // Table A.6.
H.264 and H.265 levels' names are usually of the form "x" or "x.y" with x and y being single digits; the one exception are the H.264 1b levels. All of those levels' names fit into a char[4] and it is likely that this future levels will do so, too. Therefore this commit changes the H26(4|5)LevelDescriptor structures to use such a char [4] instead of a pointer to a const char. This makes the structures smaller (when sizeof(char*) == 8) and avoids relocations, thereby moving the corresponding arrays from .data.rel.ro into .rodata. Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com> --- libavcodec/h264_levels.h | 2 +- libavcodec/h265_profile_level.h | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-)