[FFmpeg-cvslog] avcodec/wavpack: reduce extra dereferencing inside loops

2023-08-16 Thread Paul B Mahol
ffmpeg | branch: master | Paul B Mahol  | Tue Aug 15 22:13:07 
2023 +0200| [8f7850a22ec9190731aafad00ec36807565c5323] | committer: Paul B Mahol

avcodec/wavpack: reduce extra dereferencing inside loops

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

 libavcodec/wavpack.c | 126 +++
 1 file changed, 66 insertions(+), 60 deletions(-)

diff --git a/libavcodec/wavpack.c b/libavcodec/wavpack.c
index 71e7d40c81..1723c47d2a 100644
--- a/libavcodec/wavpack.c
+++ b/libavcodec/wavpack.c
@@ -794,71 +794,73 @@ static inline int wv_unpack_stereo(WavpackFrameContext 
*s, GetBitContext *gb,
 if (last)
 break;
 for (i = 0; i < s->terms; i++) {
-t = s->decorr[i].value;
+Decorr *decorr = &s->decorr[i];
+
+t = decorr->value;
 if (t > 0) {
 if (t > 8) {
 if (t & 1) {
-A = 2U * s->decorr[i].samplesA[0] - 
s->decorr[i].samplesA[1];
-B = 2U * s->decorr[i].samplesB[0] - 
s->decorr[i].samplesB[1];
+A = 2U * decorr->samplesA[0] - decorr->samplesA[1];
+B = 2U * decorr->samplesB[0] - decorr->samplesB[1];
 } else {
-A = (int)(3U * s->decorr[i].samplesA[0] - 
s->decorr[i].samplesA[1]) >> 1;
-B = (int)(3U * s->decorr[i].samplesB[0] - 
s->decorr[i].samplesB[1]) >> 1;
+A = (int)(3U * decorr->samplesA[0] - 
decorr->samplesA[1]) >> 1;
+B = (int)(3U * decorr->samplesB[0] - 
decorr->samplesB[1]) >> 1;
 }
-s->decorr[i].samplesA[1] = s->decorr[i].samplesA[0];
-s->decorr[i].samplesB[1] = s->decorr[i].samplesB[0];
-j= 0;
+decorr->samplesA[1] = decorr->samplesA[0];
+decorr->samplesB[1] = decorr->samplesB[0];
+j   = 0;
 } else {
-A = s->decorr[i].samplesA[pos];
-B = s->decorr[i].samplesB[pos];
+A = decorr->samplesA[pos];
+B = decorr->samplesB[pos];
 j = (pos + t) & 7;
 }
 if (type != AV_SAMPLE_FMT_S16P) {
-L2 = L + ((s->decorr[i].weightA * (int64_t)A + 512) >> 10);
-R2 = R + ((s->decorr[i].weightB * (int64_t)B + 512) >> 10);
+L2 = L + ((decorr->weightA * (int64_t)A + 512) >> 10);
+R2 = R + ((decorr->weightB * (int64_t)B + 512) >> 10);
 } else {
-L2 = L + (unsigned)((int)(s->decorr[i].weightA * 
(unsigned)A + 512) >> 10);
-R2 = R + (unsigned)((int)(s->decorr[i].weightB * 
(unsigned)B + 512) >> 10);
+L2 = L + (unsigned)((int)(decorr->weightA * (unsigned)A + 
512) >> 10);
+R2 = R + (unsigned)((int)(decorr->weightB * (unsigned)B + 
512) >> 10);
 }
 if (A && L)
-s->decorr[i].weightA -= L ^ A) >> 30) & 2) - 1) * 
s->decorr[i].delta;
+decorr->weightA -= L ^ A) >> 30) & 2) - 1) * 
decorr->delta;
 if (B && R)
-s->decorr[i].weightB -= R ^ B) >> 30) & 2) - 1) * 
s->decorr[i].delta;
-s->decorr[i].samplesA[j] = L = L2;
-s->decorr[i].samplesB[j] = R = R2;
+decorr->weightB -= R ^ B) >> 30) & 2) - 1) * 
decorr->delta;
+decorr->samplesA[j] = L = L2;
+decorr->samplesB[j] = R = R2;
 } else if (t == -1) {
 if (type != AV_SAMPLE_FMT_S16P)
-L2 = L + ((s->decorr[i].weightA * 
(int64_t)s->decorr[i].samplesA[0] + 512) >> 10);
+L2 = L + ((decorr->weightA * (int64_t)decorr->samplesA[0] 
+ 512) >> 10);
 else
-L2 = L + (unsigned)((int)(s->decorr[i].weightA * 
(unsigned)s->decorr[i].samplesA[0] + 512) >> 10);
-UPDATE_WEIGHT_CLIP(s->decorr[i].weightA, s->decorr[i].delta, 
s->decorr[i].samplesA[0], L);
+L2 = L + (unsigned)((int)(decorr->weightA * 
(unsigned)decorr->samplesA[0] + 512) >> 10);
+UPDATE_WEIGHT_CLIP(decorr->weightA, decorr->delta, 
decorr->samplesA[0], L);
 L = L2;
 if (type != AV_SAMPLE_FMT_S16P)
-R2 = R + ((s->decorr[i].weightB * (int64_t)L2 + 512) >> 
10);
+R2 = R + ((decorr->weightB * (int64_t)L2 + 512) >> 10);
 else
-R2 = R + (unsigned)((int)(s->decorr[i].weightB * 
(unsigned)L2 + 512) >> 10);
-UPDATE_WEIGHT_CLIP(s->decorr[i].weightB, s->decorr[i].delta, 
L2, R);
-

[FFmpeg-cvslog] avcodec/tta: fix minor code style issues

2023-08-16 Thread Paul B Mahol
ffmpeg | branch: master | Paul B Mahol  | Wed Aug 16 20:03:42 
2023 +0200| [082133fc076e67640a0e846c11389d67d7ea5ec6] | committer: Paul B Mahol

avcodec/tta: fix minor code style issues

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

 libavcodec/tta.c | 9 +
 libavcodec/ttadata.c | 3 ++-
 libavcodec/ttadsp.c  | 3 ++-
 3 files changed, 9 insertions(+), 6 deletions(-)

diff --git a/libavcodec/tta.c b/libavcodec/tta.c
index 3e89571f16..f5e39df98d 100644
--- a/libavcodec/tta.c
+++ b/libavcodec/tta.c
@@ -211,7 +211,7 @@ static av_cold int tta_decode_init(AVCodecContext * avctx)
 av_log(avctx, AV_LOG_DEBUG, "data_length: %d frame_length: %d last: %d 
total: %d\n",
 s->data_length, s->frame_length, s->last_frame_length, 
total_frames);
 
-if(s->frame_length >= UINT_MAX / (s->channels * sizeof(int32_t))){
+if (s->frame_length >= UINT_MAX / (s->channels * sizeof(int32_t))) {
 av_log(avctx, AV_LOG_ERROR, "frame_length too large\n");
 return AVERROR_INVALIDDATA;
 }
@@ -306,14 +306,14 @@ static int tta_decode_frame(AVCodecContext *avctx, 
AVFrame *frame,
 rice->sum1 += value - (rice->sum1 >> 4);
 if (rice->k1 > 0 && rice->sum1 < ff_tta_shift_16[rice->k1])
 rice->k1--;
-else if(rice->sum1 > ff_tta_shift_16[rice->k1 + 1])
+else if (rice->sum1 > ff_tta_shift_16[rice->k1 + 1])
 rice->k1++;
 value += ff_tta_shift_1[rice->k0];
 default:
 rice->sum0 += value - (rice->sum0 >> 4);
 if (rice->k0 > 0 && rice->sum0 < ff_tta_shift_16[rice->k0])
 rice->k0--;
-else if(rice->sum0 > ff_tta_shift_16[rice->k0 + 1])
+else if (rice->sum0 > ff_tta_shift_16[rice->k0 + 1])
 rice->k0++;
 }
 
@@ -399,7 +399,8 @@ error:
 return ret;
 }
 
-static av_cold int tta_decode_close(AVCodecContext *avctx) {
+static av_cold int tta_decode_close(AVCodecContext *avctx)
+{
 TTAContext *s = avctx->priv_data;
 
 if (s->bps < 3)
diff --git a/libavcodec/ttadata.c b/libavcodec/ttadata.c
index 297d709480..2137a23033 100644
--- a/libavcodec/ttadata.c
+++ b/libavcodec/ttadata.c
@@ -47,7 +47,8 @@ void ff_tta_rice_init(TTARice *c, uint32_t k0, uint32_t k1)
 c->sum1 = ff_tta_shift_16[k1];
 }
 
-void ff_tta_filter_init(TTAFilter *c, int32_t shift) {
+void ff_tta_filter_init(TTAFilter *c, int32_t shift)
+{
 memset(c, 0, sizeof(TTAFilter));
 c->shift = shift;
 c->round = ff_tta_shift_1[shift-1];
diff --git a/libavcodec/ttadsp.c b/libavcodec/ttadsp.c
index fe9e3c69e4..5dda19587c 100644
--- a/libavcodec/ttadsp.c
+++ b/libavcodec/ttadsp.c
@@ -22,7 +22,8 @@
 
 static void tta_filter_process_c(int32_t *qmi, int32_t *dx, int32_t *dl,
  int32_t *error, int32_t *in, int32_t shift,
- int32_t round) {
+ int32_t round)
+{
 uint32_t *qm = qmi;
 
 if (*error < 0) {

___
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] avcodec/wavpack: fix indentation

2023-08-16 Thread Paul B Mahol
ffmpeg | branch: master | Paul B Mahol  | Wed Aug 16 21:51:59 
2023 +0200| [3057ce797f6e1348b978f5ffe9e2afd2224544f0] | committer: Paul B Mahol

avcodec/wavpack: fix indentation

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

 libavcodec/wavpack.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/libavcodec/wavpack.c b/libavcodec/wavpack.c
index 1723c47d2a..966f4b83db 100644
--- a/libavcodec/wavpack.c
+++ b/libavcodec/wavpack.c
@@ -1131,7 +1131,7 @@ static int wavpack_decode_block(AVCodecContext *avctx, 
int block_no,
 else if ((s->frame_flags & 0x03) <= 1)
 sample_fmt = AV_SAMPLE_FMT_S16P;
 else
-sample_fmt  = AV_SAMPLE_FMT_S32P;
+sample_fmt = AV_SAMPLE_FMT_S32P;
 
 if (wc->ch_offset && avctx->sample_fmt != sample_fmt)
 return AVERROR_INVALIDDATA;

___
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] lavc/qsvenc: return error with zero output

2023-08-16 Thread Haihao Xiang
ffmpeg | branch: master | Haihao Xiang  | Thu Aug 10 
14:37:14 2023 +0800| [e0a5c35270c68d77d101e518901de5a9f002b451] | committer: 
Haihao Xiang

lavc/qsvenc: return error with zero output

Signed-off-by: Haihao Xiang 

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

 libavcodec/qsvenc.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/libavcodec/qsvenc.c b/libavcodec/qsvenc.c
index 7ff9d333a2..b3b7475b0f 100644
--- a/libavcodec/qsvenc.c
+++ b/libavcodec/qsvenc.c
@@ -2584,7 +2584,7 @@ int ff_qsv_encode(AVCodecContext *avctx, QSVEncContext *q,
 pict_type = AV_PICTURE_TYPE_P;
 else if (qpkt.bs->FrameType & MFX_FRAMETYPE_B || qpkt.bs->FrameType & 
MFX_FRAMETYPE_xB)
 pict_type = AV_PICTURE_TYPE_B;
-else if (qpkt.bs->FrameType == MFX_FRAMETYPE_UNKNOWN) {
+else if (qpkt.bs->FrameType == MFX_FRAMETYPE_UNKNOWN && 
qpkt.bs->DataLength) {
 pict_type = AV_PICTURE_TYPE_NONE;
 av_log(avctx, AV_LOG_WARNING, "Unknown FrameType, set pict_type to 
AV_PICTURE_TYPE_NONE.\n");
 } else {

___
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] lavu/hwcontext_vaapi: Add vaapi_drm_format_map support for x2rgb10

2023-08-16 Thread David Rosca
ffmpeg | branch: master | David Rosca  | Thu Aug 10 08:32:15 
2023 +0200| [2ec58055f5c52535154c1f959acce878df22e18d] | committer: Haihao Xiang

lavu/hwcontext_vaapi: Add vaapi_drm_format_map support for x2rgb10

Support for allocating frames with x2rgb10 format was added
in c00264f5013, this adds support for importing DMA-BUFs.

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

 libavutil/hwcontext_vaapi.c | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/libavutil/hwcontext_vaapi.c b/libavutil/hwcontext_vaapi.c
index 6c3a227ddd..558fed94c6 100644
--- a/libavutil/hwcontext_vaapi.c
+++ b/libavutil/hwcontext_vaapi.c
@@ -1048,6 +1048,9 @@ static const struct {
 #if defined(VA_FOURCC_Y412) && defined(DRM_FORMAT_XVYU12_16161616)
 DRM_MAP(Y412, 1, DRM_FORMAT_XVYU12_16161616),
 #endif
+#if defined(VA_FOURCC_X2R10G10B10) && defined(DRM_FORMAT_XRGB2101010)
+DRM_MAP(X2R10G10B10, 1, DRM_FORMAT_XRGB2101010),
+#endif
 };
 #undef DRM_MAP
 

___
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] libavfilter/vf_vpp_qsv: Fix a timestamp bug when framerate is not set

2023-08-16 Thread Wenbin Chen
ffmpeg | branch: master | Wenbin Chen  | Tue Aug 15 
16:34:25 2023 +0800| [9ae4863cc57c38fa2f41f3b8c732fede4a2b78c6] | committer: 
Haihao Xiang

libavfilter/vf_vpp_qsv: Fix a timestamp bug when framerate is not set

If user doesn't set framerate when he creates a filter, the filter uses
default framerate {0, 1}. This causes error when setting timebase to
1/framerate. Now change it to pass inlink->time_base to outlink when
framerate is not set.
This patch fixes ticket: #10476 #10468

Signed-off-by: Wenbin Chen 

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

 libavfilter/vf_vpp_qsv.c | 5 -
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/libavfilter/vf_vpp_qsv.c b/libavfilter/vf_vpp_qsv.c
index 92ef0f1d89..c07b45fedb 100644
--- a/libavfilter/vf_vpp_qsv.c
+++ b/libavfilter/vf_vpp_qsv.c
@@ -536,7 +536,10 @@ static int config_output(AVFilterLink *outlink)
 outlink->w  = vpp->out_width;
 outlink->h  = vpp->out_height;
 outlink->frame_rate = vpp->framerate;
-outlink->time_base  = av_inv_q(vpp->framerate);
+if (vpp->framerate.num == 0 || vpp->framerate.den == 0)
+outlink->time_base = inlink->time_base;
+else
+outlink->time_base = av_inv_q(vpp->framerate);
 
 param.filter_frame  = NULL;
 param.set_frame_ext_params = vpp_set_frame_ext_params;

___
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] lavc/qsvenc_hevc: restore the default gop size

2023-08-16 Thread Haihao Xiang
ffmpeg | branch: master | Haihao Xiang  | Fri Aug 11 
14:35:41 2023 +0800| [a7f24d79b8eeb4f4ab78916ef08cc997f2381cc9] | committer: 
Haihao Xiang

lavc/qsvenc_hevc: restore the default gop size

commit a3c0a3e changed the default settings and expected the runtime can
choose a best value. However the runtime doesn't set a valid gop size
for hevc encoder, hence the output steam is non-seekable, which is
inconvenient to user [1][2]

[1] https://github.com/intel/media-driver/issues/1576
[2] https://ffmpeg.org/pipermail/ffmpeg-user/2023-August/056716.html

Signed-off-by: Haihao Xiang 

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

 libavcodec/qsvenc_hevc.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/libavcodec/qsvenc_hevc.c b/libavcodec/qsvenc_hevc.c
index 5e23ca9647..c5b7ac7cc4 100644
--- a/libavcodec/qsvenc_hevc.c
+++ b/libavcodec/qsvenc_hevc.c
@@ -376,7 +376,7 @@ static const AVClass class = {
 static const FFCodecDefault qsv_enc_defaults[] = {
 { "b", "1M"},
 { "refs",  "0" },
-{ "g", "-1"},
+{ "g", "248"   },
 { "bf","-1"},
 { "qmin",  "-1"},
 { "qmax",  "-1"},

___
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".