shithub: openh264

Download patch

ref: 8f3c129f254b29a00dcca65b29dda8aafba8ac53
parent: 469419bfb4cf1aba6550114795b4d8615927aa3c
author: Martin Storsjö <martin@martin.st>
date: Sat Dec 28 18:38:18 EST 2013

Remove pragmas for non-standard struct packing in the public API

These pragmas specified that structs should be packed in a way
different from the normal way defined by the current platform ABI.
Since these pragmas are in headers part of the public API, and the
pragmas are nonstandard, this is a portability and compatibility
hazard (all code calling the library need to have the same support
for the nonstandard pragma).

Additionally, accessing unaligned struct members (as produced by this
tight struct packing) can give reduced performance or even lead to
crashes on platforms that require strict alignment.

The only theoretical possible benefits of using the pragma are either
matching a certain struct layout defined in some other, fixed ABI
(but since this is an interface defined by this library itself, there's
no such prior binary interface that needs to be matched), or to reduce
the memory usage by packing the structs tighter (where the reduction
would be marginal at best).

--- a/codec/api/svc/codec_app_def.h
+++ b/codec/api/svc/codec_app_def.h
@@ -161,7 +161,6 @@
   unsigned int  uiIDRPicId; // distinguish request from different IDR
   int			  iLTRFrameNum; //specify current decoder frame_num
 } SLTRMarkingFeedback;
-#pragma pack(1)
 
 typedef struct {
 
@@ -277,5 +276,4 @@
 } SSourcePicture;
 
 
-#pragma pack()
 #endif//WELS_VIDEO_CODEC_APPLICATION_DEFINITION_H__
--- a/codec/api/svc/codec_def.h
+++ b/codec/api/svc/codec_def.h
@@ -112,8 +112,6 @@
 #define FRAME_NUM_PARAM_SET		(-1)
 #define FRAME_NUM_IDR			0
 
-#pragma pack(1)
-
 /* Error Tools definition */
 typedef unsigned short ERR_TOOL;
 enum {
@@ -235,7 +233,5 @@
 static const char kiKeyNumMultiple[] = {
   1, 1, 2, 4, 8, 16,
 };
-
-#pragma pack()
 
 #endif//WELS_VIDEO_CODEC_DEFINITION_H__