[FFmpeg-cvslog] x86/yuv2rgb: fix crashes when storing data on unaligned buffers

2020-07-14 Thread James Almer
ffmpeg | branch: master | James Almer  | Sun Jul 12 21:32:01 
2020 -0300| [ba3e771a42c29ee02c34e7769cfc1b2dbc5c760a] | committer: James Almer

x86/yuv2rgb: fix crashes when storing data on unaligned buffers

Regression since fc6a5883d6af8cae0e96af84dda0ad74b360a084 on SSSE3 enabled
CPUs.

Fixes ticket #8747

Signed-off-by: James Almer 

> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=ba3e771a42c29ee02c34e7769cfc1b2dbc5c760a
---

 libswscale/x86/yuv_2_rgb.asm | 18 +-
 1 file changed, 9 insertions(+), 9 deletions(-)

diff --git a/libswscale/x86/yuv_2_rgb.asm b/libswscale/x86/yuv_2_rgb.asm
index 575a84d921..003dff1f25 100644
--- a/libswscale/x86/yuv_2_rgb.asm
+++ b/libswscale/x86/yuv_2_rgb.asm
@@ -268,9 +268,9 @@ cglobal %1_420_%2%3, GPR_num, GPR_num, reg_num, parameters
 porm2, m7
 porm1, m6  ; g5  b5  r6  g6  b6  r7  g7  b7  r8  g8  b8  r9  
g9  b9  r10 g10
 porm2, m3  ; b10 r11 g11 b11 r12 g12 b12 r13 g13 b13 r14 g14 
b14 r15 g15 b15
-mova [imageq], m0
-mova [imageq + 16], m1
-mova [imageq + 32], m2
+movu [imageq], m0
+movu [imageq + 16], m1
+movu [imageq + 32], m2
 %endif ; mmsize = 16
 %else ; PACK RGB15/16/32
 packuswb m0, m1
@@ -300,10 +300,10 @@ cglobal %1_420_%2%3, GPR_num, GPR_num, reg_num, parameters
 punpckhwd m_green, m_red
 punpcklwd m5, m6
 punpckhwd m_alpha, m6
-mova [imageq + 0], m_blue
-mova [imageq + 8  * time_num], m_green
-mova [imageq + 16 * time_num], m5
-mova [imageq + 24 * time_num], m_alpha
+movu [imageq + 0], m_blue
+movu [imageq + 8  * time_num], m_green
+movu [imageq + 16 * time_num], m5
+movu [imageq + 24 * time_num], m_alpha
 %else ; PACK RGB15/16
 %define depth 2
 %if cpuflag(ssse3)
@@ -342,8 +342,8 @@ cglobal %1_420_%2%3, GPR_num, GPR_num, reg_num, parameters
 mova m2, m0
 punpcklbw m0, m1
 punpckhbw m2, m1
-mova [imageq], m0
-mova [imageq + 8 * time_num], m2
+movu [imageq], m0
+movu [imageq + 8 * time_num], m2
 %endif ; PACK RGB15/16
 %endif ; PACK RGB15/16/32
 

___
ffmpeg-cvslog mailing list
ffmpeg-cvslog@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-cvslog

To unsubscribe, visit link above, or email
ffmpeg-cvslog-requ...@ffmpeg.org with subject "unsubscribe".

[FFmpeg-cvslog] libavcodec/jpeg2000dec : Prevent overriding SOP marker bit

2020-07-14 Thread Gautam Ramakrishnan
ffmpeg | branch: master | Gautam Ramakrishnan  | Tue Jul 
14 22:31:13 2020 +0530| [05f3d37dd58b1626c8e587cdf11af5a0ab65d377] | committer: 
Michael Niedermayer

libavcodec/jpeg2000dec : Prevent overriding SOP marker bit

Currently, the COC marker overrides the SOP marker bit.
However, only the COD marker may set this value. This
patch fixes this bug.

Signed-off-by: Michael Niedermayer 

> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=05f3d37dd58b1626c8e587cdf11af5a0ab65d377
---

 libavcodec/jpeg2000dec.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/libavcodec/jpeg2000dec.c b/libavcodec/jpeg2000dec.c
index 18a933077e..48ca1c37a5 100644
--- a/libavcodec/jpeg2000dec.c
+++ b/libavcodec/jpeg2000dec.c
@@ -588,7 +588,7 @@ static int get_coc(Jpeg2000DecoderContext *s, 
Jpeg2000CodingStyle *c,
uint8_t *properties)
 {
 int compno, ret;
-uint8_t has_eph;
+uint8_t has_eph, has_sop;
 
 if (bytestream2_get_bytes_left(&s->g) < 2) {
 av_log(s->avctx, AV_LOG_ERROR, "Insufficient space for COC\n");
@@ -606,8 +606,10 @@ static int get_coc(Jpeg2000DecoderContext *s, 
Jpeg2000CodingStyle *c,
 
 c  += compno;
 has_eph = c->csty & JPEG2000_CSTY_EPH;
+has_sop = c->csty & JPEG2000_CSTY_SOP;
 c->csty = bytestream2_get_byteu(&s->g);
 c->csty |= has_eph; //do not override eph present bits from COD
+c->csty |= has_sop; //do not override sop present bits from COD
 
 if ((ret = get_cox(s, c)) < 0)
 return ret;

___
ffmpeg-cvslog mailing list
ffmpeg-cvslog@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-cvslog

To unsubscribe, visit link above, or email
ffmpeg-cvslog-requ...@ffmpeg.org with subject "unsubscribe".

[FFmpeg-cvslog] swscale/tests/swscale: Fix incorrect return code check

2020-07-14 Thread Michael Niedermayer
ffmpeg | branch: master | Michael Niedermayer  | Sat 
Jul 11 23:35:00 2020 +0200| [ec27c1827c1ff6ef8b543966206d8e6a9507532b] | 
committer: Michael Niedermayer

swscale/tests/swscale: Fix incorrect return code check

Regression since: 3adffab073bc59af39035168ac72bc9ffde3

Reviewed-by: Martin Storsjö 
Signed-off-by: Michael Niedermayer 

> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=ec27c1827c1ff6ef8b543966206d8e6a9507532b
---

 libswscale/tests/swscale.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/libswscale/tests/swscale.c b/libswscale/tests/swscale.c
index 693f439bf5..58870fdb78 100644
--- a/libswscale/tests/swscale.c
+++ b/libswscale/tests/swscale.c
@@ -423,7 +423,7 @@ bad_option:
 for (x = 0; x < W * 4; x++)
 rgb_data[ x + y * 4 * W] = av_lfg_get(&rand);
 res = sws_scale(sws, rgb_src, rgb_stride, 0, H / 12, (uint8_t * const *) 
src, stride);
-if (res < 0 || res != (H / 12))
+if (res < 0 || res != H)
 goto error;
 sws_freeContext(sws);
 av_free(rgb_data);

___
ffmpeg-cvslog mailing list
ffmpeg-cvslog@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-cvslog

To unsubscribe, visit link above, or email
ffmpeg-cvslog-requ...@ffmpeg.org with subject "unsubscribe".

[FFmpeg-cvslog] swscale/tests/swscale: Initialize res to a non random error code

2020-07-14 Thread Michael Niedermayer
ffmpeg | branch: master | Michael Niedermayer  | Sat 
Jul 11 23:57:41 2020 +0200| [24c575e0aa6b469eeaa1bd8f7ffc0fe6732495d0] | 
committer: Michael Niedermayer

swscale/tests/swscale: Initialize res to a non random error code

Regression since: 3adffab073bc59af39035168ac72bc9ffde3

-1 is consistent what other error paths return

Reviewed-by: Martin Storsjö 
Signed-off-by: Michael Niedermayer 

> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=24c575e0aa6b469eeaa1bd8f7ffc0fe6732495d0
---

 libswscale/tests/swscale.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/libswscale/tests/swscale.c b/libswscale/tests/swscale.c
index 58870fdb78..845ced61bb 100644
--- a/libswscale/tests/swscale.c
+++ b/libswscale/tests/swscale.c
@@ -423,8 +423,10 @@ bad_option:
 for (x = 0; x < W * 4; x++)
 rgb_data[ x + y * 4 * W] = av_lfg_get(&rand);
 res = sws_scale(sws, rgb_src, rgb_stride, 0, H / 12, (uint8_t * const *) 
src, stride);
-if (res < 0 || res != H)
+if (res < 0 || res != H) {
+res = -1;
 goto error;
+}
 sws_freeContext(sws);
 av_free(rgb_data);
 

___
ffmpeg-cvslog mailing list
ffmpeg-cvslog@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-cvslog

To unsubscribe, visit link above, or email
ffmpeg-cvslog-requ...@ffmpeg.org with subject "unsubscribe".

[FFmpeg-cvslog] API: add AV_PKT_DATA_S12M_TIMECODE to AVPacketSideDataType

2020-07-14 Thread Limin Wang
ffmpeg | branch: master | Limin Wang  | Tue Jun 30 
23:18:17 2020 +0800| [448a9aaa78119e0ac059ed08fa17613df63c780b] | committer: 
Limin Wang

API: add AV_PKT_DATA_S12M_TIMECODE to AVPacketSideDataType

Signed-off-by: Limin Wang 

> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=448a9aaa78119e0ac059ed08fa17613df63c780b
---

 doc/APIchanges|  3 +++
 libavcodec/avpacket.c |  1 +
 libavcodec/decode.c   |  1 +
 libavcodec/packet.h   |  8 
 libavcodec/version.h  |  2 +-
 libavformat/dump.c| 21 +
 6 files changed, 35 insertions(+), 1 deletion(-)

diff --git a/doc/APIchanges b/doc/APIchanges
index 1d6cc36b8c..67f2ac360f 100644
--- a/doc/APIchanges
+++ b/doc/APIchanges
@@ -15,6 +15,9 @@ libavutil: 2017-10-21
 
 API changes, most recent first:
 
+2020-07-xx - xx - lavc 58.96.100 - packet.h
+  Add AV_PKT_DATA_S12M_TIMECODE.
+
 2020-06-12 - b09fb030c1 - lavu 56.55.100 - pixdesc.h
   Add AV_PIX_FMT_X2RGB10.
 
diff --git a/libavcodec/avpacket.c b/libavcodec/avpacket.c
index dce26cb31a..4801163227 100644
--- a/libavcodec/avpacket.c
+++ b/libavcodec/avpacket.c
@@ -400,6 +400,7 @@ const char *av_packet_side_data_name(enum 
AVPacketSideDataType type)
 case AV_PKT_DATA_PRFT:   return "Producer Reference 
Time";
 case AV_PKT_DATA_ICC_PROFILE:return "ICC Profile";
 case AV_PKT_DATA_DOVI_CONF:  return "DOVI configuration 
record";
+case AV_PKT_DATA_S12M_TIMECODE:  return "SMPTE ST 12-1:2014 
timecode";
 }
 return NULL;
 }
diff --git a/libavcodec/decode.c b/libavcodec/decode.c
index de9c079f9d..f2244fc9d9 100644
--- a/libavcodec/decode.c
+++ b/libavcodec/decode.c
@@ -1699,6 +1699,7 @@ int ff_decode_frame_props(AVCodecContext *avctx, AVFrame 
*frame)
 { AV_PKT_DATA_CONTENT_LIGHT_LEVEL,
AV_FRAME_DATA_CONTENT_LIGHT_LEVEL },
 { AV_PKT_DATA_A53_CC, AV_FRAME_DATA_A53_CC },
 { AV_PKT_DATA_ICC_PROFILE,AV_FRAME_DATA_ICC_PROFILE },
+{ AV_PKT_DATA_S12M_TIMECODE,  AV_FRAME_DATA_S12M_TIMECODE 
},
 };
 
 if (pkt) {
diff --git a/libavcodec/packet.h b/libavcodec/packet.h
index 96f237f091..0a19a0eff3 100644
--- a/libavcodec/packet.h
+++ b/libavcodec/packet.h
@@ -282,6 +282,14 @@ enum AVPacketSideDataType {
  */
 AV_PKT_DATA_DOVI_CONF,
 
+/**
+ * Timecode which conforms to SMPTE ST 12-1:2014. The data is an array of 
4 uint32_t
+ * where the first uint32_t describes how many (1-3) of the other 
timecodes are used.
+ * The timecode format is described in the documentation of 
av_timecode_get_smpte_from_framenum()
+ * function in libavutil/timecode.h.
+ */
+AV_PKT_DATA_S12M_TIMECODE,
+
 /**
  * The number of side data types.
  * This is not part of the public API/ABI in the sense that it may
diff --git a/libavcodec/version.h b/libavcodec/version.h
index e75891d463..ad0bfd619d 100644
--- a/libavcodec/version.h
+++ b/libavcodec/version.h
@@ -28,7 +28,7 @@
 #include "libavutil/version.h"
 
 #define LIBAVCODEC_VERSION_MAJOR  58
-#define LIBAVCODEC_VERSION_MINOR  95
+#define LIBAVCODEC_VERSION_MINOR  96
 #define LIBAVCODEC_VERSION_MICRO 100
 
 #define LIBAVCODEC_VERSION_INT  AV_VERSION_INT(LIBAVCODEC_VERSION_MAJOR, \
diff --git a/libavformat/dump.c b/libavformat/dump.c
index aacc0c111c..6d29d85d1f 100644
--- a/libavformat/dump.c
+++ b/libavformat/dump.c
@@ -34,6 +34,7 @@
 #include "libavutil/replaygain.h"
 #include "libavutil/spherical.h"
 #include "libavutil/stereo3d.h"
+#include "libavutil/timecode.h"
 
 #include "avformat.h"
 
@@ -407,6 +408,22 @@ static void dump_dovi_conf(void *ctx, const 
AVPacketSideData *sd)
dovi->dv_bl_signal_compatibility_id);
 }
 
+static void dump_s12m_timecode(void *ctx, const AVPacketSideData *sd)
+{
+const uint32_t *tc = (const uint32_t *)sd->data;
+
+if ((sd->size != sizeof(uint32_t) * 4) || (tc[0] > 3)) {
+av_log(ctx, AV_LOG_ERROR, "invalid data\n");
+return;
+}
+
+for (int j = 1; j <= tc[0]; j++) {
+char tcbuf[AV_TIMECODE_STR_SIZE];
+av_timecode_make_smpte_tc_string(tcbuf, tc[j], 0);
+av_log(ctx, AV_LOG_INFO, "timecode - %s%s", tcbuf, j != tc[0] ? ", " : 
"");
+}
+}
+
 static void dump_sidedata(void *ctx, const AVStream *st, const char *indent)
 {
 int i;
@@ -473,6 +490,10 @@ static void dump_sidedata(void *ctx, const AVStream *st, 
const char *indent)
 av_log(ctx, AV_LOG_INFO, "DOVI configuration record: ");
 dump_dovi_conf(ctx, sd);
 break;
+case AV_PKT_DATA_S12M_TIMECODE:
+av_log(ctx, AV_LOG_INFO, "SMPTE ST 12-1:2014: ");
+dump_s12m_timecode(ctx, sd);
+break;
 default:
 av_log(ctx, AV_LOG_INFO,
"unknown side data type %d (%d bytes)", sd->type, sd->size);

___
ffmpeg-cvslog mailing list
ffmpe

[FFmpeg-cvslog] avdevice/decklink_dec: export timecode with s12m side data

2020-07-14 Thread Limin Wang
ffmpeg | branch: master | Limin Wang  | Sun Jul 12 
06:29:10 2020 +0800| [a54b367c781f7735c321e6ac08a5deebeb9796a9] | committer: 
Limin Wang

avdevice/decklink_dec: export timecode with s12m side data

Reviewed-by: Marton Balint 
Signed-off-by: Limin Wang 

> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=a54b367c781f7735c321e6ac08a5deebeb9796a9
---

 libavdevice/decklink_dec.cpp | 14 ++
 1 file changed, 14 insertions(+)

diff --git a/libavdevice/decklink_dec.cpp b/libavdevice/decklink_dec.cpp
index a499972df8..dde68ffddc 100644
--- a/libavdevice/decklink_dec.cpp
+++ b/libavdevice/decklink_dec.cpp
@@ -42,6 +42,7 @@ extern "C" {
 #include "libavutil/imgutils.h"
 #include "libavutil/intreadwrite.h"
 #include "libavutil/time.h"
+#include "libavutil/timecode.h"
 #include "libavutil/mathematics.h"
 #include "libavutil/reverse.h"
 #include "avdevice.h"
@@ -882,6 +883,19 @@ HRESULT decklink_input_callback::VideoInputFrameArrived(
 AVDictionary* metadata_dict = NULL;
 int metadata_len;
 uint8_t* packed_metadata;
+AVTimecode tcr;
+
+if (av_timecode_init_from_string(&tcr, 
ctx->video_st->r_frame_rate, tc, ctx) >= 0) {
+uint32_t tc_data = 
av_timecode_get_smpte_from_framenum(&tcr, 0);
+int size = sizeof(uint32_t) * 4;
+uint32_t *sd = (uint32_t 
*)av_packet_new_side_data(&pkt, AV_PKT_DATA_S12M_TIMECODE, size);
+
+if (sd) {
+*sd   = 1;   // one TC
+*(sd + 1) = tc_data; // TC
+}
+}
+
 if (av_dict_set(&metadata_dict, "timecode", tc, 
AV_DICT_DONT_STRDUP_VAL) >= 0) {
 packed_metadata = 
av_packet_pack_dictionary(metadata_dict, &metadata_len);
 av_dict_free(&metadata_dict);

___
ffmpeg-cvslog mailing list
ffmpeg-cvslog@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-cvslog

To unsubscribe, visit link above, or email
ffmpeg-cvslog-requ...@ffmpeg.org with subject "unsubscribe".

[FFmpeg-cvslog] avutil/timecode: add description for SMPTE binary format

2020-07-14 Thread Limin Wang
ffmpeg | branch: master | Limin Wang  | Tue Jun 30 
23:22:58 2020 +0800| [c24c6a1bee10fc5526803dbeaf2a18453f50b9a8] | committer: 
Limin Wang

avutil/timecode: add description for SMPTE binary format

Signed-off-by: Limin Wang 

> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=c24c6a1bee10fc5526803dbeaf2a18453f50b9a8
---

 libavutil/frame.h|  4 ++--
 libavutil/timecode.h | 13 +
 2 files changed, 15 insertions(+), 2 deletions(-)

diff --git a/libavutil/frame.h b/libavutil/frame.h
index 3fb8c56be8..3bd240fc97 100644
--- a/libavutil/frame.h
+++ b/libavutil/frame.h
@@ -162,8 +162,8 @@ enum AVFrameSideDataType {
 /**
  * Timecode which conforms to SMPTE ST 12-1. The data is an array of 4 
uint32_t
  * where the first uint32_t describes how many (1-3) of the other 
timecodes are used.
- * The timecode format is described in the 
av_timecode_get_smpte_from_framenum()
- * function in libavutil/timecode.c.
+ * The timecode format is described in the documentation of 
av_timecode_get_smpte_from_framenum()
+ * function in libavutil/timecode.h.
  */
 AV_FRAME_DATA_S12M_TIMECODE,
 
diff --git a/libavutil/timecode.h b/libavutil/timecode.h
index ab38e661f1..5801330921 100644
--- a/libavutil/timecode.h
+++ b/libavutil/timecode.h
@@ -62,6 +62,19 @@ int av_timecode_adjust_ntsc_framenum2(int framenum, int fps);
  * @param framenum frame number
  * @return the SMPTE binary representation
  *
+ * See SMPTE ST 314M-2005 Sec 4.4.2.2.1 "Time code pack (TC)"
+ * the format description as follows:
+ * bits 0-5:   hours, in BCD(6bits)
+ * bits 6: BGF1
+ * bits 7: BGF2 (NTSC) or PC (PAL)
+ * bits 8-14:  minutes, in BCD(7bits)
+ * bits 15:BGF0 (NTSC) or BGF2 (PAL)
+ * bits 16-22: seconds, in BCD(7bits)
+ * bits 23:PC (NTSC) or BGF0 (PAL)
+ * bits 24-29: frames, in BCD(6bits)
+ * bits 30:drop  frame flag (0: non drop,1: drop)
+ * bits 31:color frame flag (0: unsync mode, 1: sync mode)
+ * @note BCD numbers (6 or 7 bits): 4 or 5 lower bits for units, 2 higher bits 
for tens.
  * @note Frame number adjustment is automatically done in case of drop 
timecode,
  *   you do NOT have to call av_timecode_adjust_ntsc_framenum2().
  * @note The frame number is relative to tc->start.

___
ffmpeg-cvslog mailing list
ffmpeg-cvslog@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-cvslog

To unsubscribe, visit link above, or email
ffmpeg-cvslog-requ...@ffmpeg.org with subject "unsubscribe".