mirror of
https://github.com/FFmpeg/FFmpeg.git
synced 2025-04-14 00:58:38 +02:00
cbs_mpeg2: Fix storage type for frame_centre_*_offset
The frame_centre_horizontal/vertical_offset values contained in picture display extensions are actually signed values (i.e. it is possible to indicate that the display device should add black bars/pillars). The files sony-ct3.bs and tcela-6.bits (which are both used in fate tests for mpeg2_metadata) contain picture display extensions; the former even contains a negative frame_centre_vertical_offset. Fortunately, the old code did not damage the picture display extensions when one did a cycle of reading and writing. For the same reason the fate tests needn't be updated either. Furthermore these fields now use the trace output for matrices. Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com> (cherry picked from commit de5880383967f44927c599ab16fa0f4f96b38365)
This commit is contained in:
parent
b010caa6c9
commit
1b6bcee9fe
@ -48,6 +48,8 @@
|
|||||||
xui(width, name, current->name, 0, MAX_UINT_BITS(width), subs, __VA_ARGS__)
|
xui(width, name, current->name, 0, MAX_UINT_BITS(width), subs, __VA_ARGS__)
|
||||||
#define uirs(width, name, subs, ...) \
|
#define uirs(width, name, subs, ...) \
|
||||||
xui(width, name, current->name, 1, MAX_UINT_BITS(width), subs, __VA_ARGS__)
|
xui(width, name, current->name, 1, MAX_UINT_BITS(width), subs, __VA_ARGS__)
|
||||||
|
#define sis(width, name, subs, ...) \
|
||||||
|
xsi(width, name, current->name, subs, __VA_ARGS__)
|
||||||
|
|
||||||
|
|
||||||
#define READ
|
#define READ
|
||||||
@ -62,6 +64,15 @@
|
|||||||
var = value; \
|
var = value; \
|
||||||
} while (0)
|
} while (0)
|
||||||
|
|
||||||
|
#define xsi(width, name, var, subs, ...) do { \
|
||||||
|
int32_t value; \
|
||||||
|
CHECK(ff_cbs_read_signed(ctx, rw, width, #name, \
|
||||||
|
SUBSCRIPTS(subs, __VA_ARGS__), &value, \
|
||||||
|
MIN_INT_BITS(width), \
|
||||||
|
MAX_INT_BITS(width))); \
|
||||||
|
var = value; \
|
||||||
|
} while (0)
|
||||||
|
|
||||||
#define marker_bit() do { \
|
#define marker_bit() do { \
|
||||||
av_unused uint32_t one; \
|
av_unused uint32_t one; \
|
||||||
CHECK(ff_cbs_read_unsigned(ctx, rw, 1, "marker_bit", NULL, &one, 1, 1)); \
|
CHECK(ff_cbs_read_unsigned(ctx, rw, 1, "marker_bit", NULL, &one, 1, 1)); \
|
||||||
@ -77,6 +88,7 @@
|
|||||||
#undef READWRITE
|
#undef READWRITE
|
||||||
#undef RWContext
|
#undef RWContext
|
||||||
#undef xui
|
#undef xui
|
||||||
|
#undef xsi
|
||||||
#undef marker_bit
|
#undef marker_bit
|
||||||
#undef nextbits
|
#undef nextbits
|
||||||
|
|
||||||
@ -91,6 +103,13 @@
|
|||||||
var, range_min, range_max)); \
|
var, range_min, range_max)); \
|
||||||
} while (0)
|
} while (0)
|
||||||
|
|
||||||
|
#define xsi(width, name, var, subs, ...) do { \
|
||||||
|
CHECK(ff_cbs_write_signed(ctx, rw, width, #name, \
|
||||||
|
SUBSCRIPTS(subs, __VA_ARGS__), var, \
|
||||||
|
MIN_INT_BITS(width), \
|
||||||
|
MAX_INT_BITS(width))); \
|
||||||
|
} while (0)
|
||||||
|
|
||||||
#define marker_bit() do { \
|
#define marker_bit() do { \
|
||||||
CHECK(ff_cbs_write_unsigned(ctx, rw, 1, "marker_bit", NULL, 1, 1, 1)); \
|
CHECK(ff_cbs_write_unsigned(ctx, rw, 1, "marker_bit", NULL, 1, 1, 1)); \
|
||||||
} while (0)
|
} while (0)
|
||||||
@ -103,6 +122,7 @@
|
|||||||
#undef READWRITE
|
#undef READWRITE
|
||||||
#undef RWContext
|
#undef RWContext
|
||||||
#undef xui
|
#undef xui
|
||||||
|
#undef xsi
|
||||||
#undef marker_bit
|
#undef marker_bit
|
||||||
#undef nextbits
|
#undef nextbits
|
||||||
|
|
||||||
|
@ -164,8 +164,8 @@ typedef struct MPEG2RawQuantMatrixExtension {
|
|||||||
} MPEG2RawQuantMatrixExtension;
|
} MPEG2RawQuantMatrixExtension;
|
||||||
|
|
||||||
typedef struct MPEG2RawPictureDisplayExtension {
|
typedef struct MPEG2RawPictureDisplayExtension {
|
||||||
uint16_t frame_centre_horizontal_offset[3];
|
int16_t frame_centre_horizontal_offset[3];
|
||||||
uint16_t frame_centre_vertical_offset[3];
|
int16_t frame_centre_vertical_offset[3];
|
||||||
} MPEG2RawPictureDisplayExtension;
|
} MPEG2RawPictureDisplayExtension;
|
||||||
|
|
||||||
typedef struct MPEG2RawExtensionData {
|
typedef struct MPEG2RawExtensionData {
|
||||||
|
@ -299,9 +299,9 @@ static int FUNC(picture_display_extension)(CodedBitstreamContext *ctx, RWContext
|
|||||||
HEADER("Picture Display Extension");
|
HEADER("Picture Display Extension");
|
||||||
|
|
||||||
for (i = 0; i < mpeg2->number_of_frame_centre_offsets; i++) {
|
for (i = 0; i < mpeg2->number_of_frame_centre_offsets; i++) {
|
||||||
ui(16, frame_centre_horizontal_offset[i]);
|
sis(16, frame_centre_horizontal_offset[i], 1, i);
|
||||||
marker_bit();
|
marker_bit();
|
||||||
ui(16, frame_centre_vertical_offset[i]);
|
sis(16, frame_centre_vertical_offset[i], 1, i);
|
||||||
marker_bit();
|
marker_bit();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user