Skip to content

Commit

Permalink
Rolling back until the origin is confirmed
Browse files Browse the repository at this point in the history
  • Loading branch information
wberube committed Jun 10, 2024
1 parent a8fc57d commit 6b2400c
Show file tree
Hide file tree
Showing 4 changed files with 22 additions and 65 deletions.
26 changes: 11 additions & 15 deletions src/hal/sstar/i6c_hal.c
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,6 @@ i6c_snr_pad _i6c_snr_pad;
i6c_snr_plane _i6c_snr_plane;
char _i6c_snr_framerate, _i6c_snr_hdr, _i6c_snr_index, _i6c_snr_profile;

char _i6c_upd_venc = 0;

char _i6c_aud_chn = 0;
char _i6c_aud_dev = 0;
char _i6c_isp_chn = 0;
Expand Down Expand Up @@ -502,14 +500,14 @@ int i6c_video_create(char index, hal_vidconfig *config)
channel.attrib.codec = I6C_VENC_CODEC_MJPG;
switch (config->mode) {
case HAL_VIDMODE_CBR:
channel.rate.mode = _i6c_upd_venc ? I6C_VENC_NRATEMODE_MJPGCBR : I6C_VENC_RATEMODE_MJPGCBR;
channel.rate.mode = I6C_VENC_RATEMODE_MJPGCBR;
channel.rate.mjpgCbr.bitrate = config->bitrate << 10;
channel.rate.mjpgCbr.fpsNum =
config->codec == HAL_VIDCODEC_JPG ? 1 : config->framerate;
channel.rate.mjpgCbr.fpsDen = 1;
break;
case HAL_VIDMODE_QP:
channel.rate.mode = _i6c_upd_venc ? I6C_VENC_NRATEMODE_MJPGQP : I6C_VENC_RATEMODE_MJPGQP;
channel.rate.mode = I6C_VENC_RATEMODE_MJPGQP;
channel.rate.mjpgQp.fpsNum = config->framerate;
channel.rate.mjpgQp.fpsDen =
config->codec == HAL_VIDCODEC_JPG ? 1 : config->framerate;
Expand All @@ -534,25 +532,25 @@ int i6c_video_create(char index, hal_vidconfig *config)
attrib = &channel.attrib.h265;
switch (config->mode) {
case HAL_VIDMODE_CBR:
channel.rate.mode = _i6c_upd_venc ? I6C_VENC_NRATEMODE_H265CBR : I6C_VENC_RATEMODE_H265CBR;
channel.rate.mode = I6C_VENC_RATEMODE_H265CBR;
channel.rate.h265Cbr = (i6c_venc_rate_h26xcbr){ .gop = config->gop,
.statTime = 1, .fpsNum = config->framerate, .fpsDen = 1, .bitrate =
(unsigned int)(config->bitrate) << 10, .avgLvl = 1 }; break;
case HAL_VIDMODE_VBR:
channel.rate.mode = _i6c_upd_venc ? I6C_VENC_NRATEMODE_H265VBR : I6C_VENC_RATEMODE_H265VBR;
channel.rate.mode = I6C_VENC_RATEMODE_H265VBR;
channel.rate.h265Vbr = (i6c_venc_rate_h26xvbr){ .gop = config->gop,
.statTime = 1, .fpsNum = config->framerate, .fpsDen = 1, .maxBitrate =
(unsigned int)(MAX(config->bitrate, config->maxBitrate)) << 10,
.maxQual = config->maxQual, .minQual = config->minQual }; break;
case HAL_VIDMODE_QP:
channel.rate.mode = _i6c_upd_venc ? I6C_VENC_NRATEMODE_H265QP : I6C_VENC_RATEMODE_H265QP;
channel.rate.mode = I6C_VENC_RATEMODE_H265QP;
channel.rate.h265Qp = (i6c_venc_rate_h26xqp){ .gop = config->gop,
.fpsNum = config->framerate, .fpsDen = 1, .interQual = config->maxQual,
.predQual = config->minQual }; break;
case HAL_VIDMODE_ABR:
I6C_ERROR("H.265 encoder does not support ABR mode!");
case HAL_VIDMODE_AVBR:
channel.rate.mode = _i6c_upd_venc ? I6C_VENC_NRATEMODE_H265AVBR : I6C_VENC_RATEMODE_H265AVBR;
channel.rate.mode = I6C_VENC_RATEMODE_H265AVBR;
channel.rate.h265Avbr = (i6c_venc_rate_h26xvbr){ .gop = config->gop,
.statTime = 1, .fpsNum = config->framerate, .fpsDen = 1, .maxBitrate =
(unsigned int)(MAX(config->bitrate, config->maxBitrate)) << 10,
Expand All @@ -565,29 +563,29 @@ int i6c_video_create(char index, hal_vidconfig *config)
attrib = &channel.attrib.h264;
switch (config->mode) {
case HAL_VIDMODE_CBR:
channel.rate.mode = _i6c_upd_venc ? I6C_VENC_NRATEMODE_H264CBR : I6C_VENC_RATEMODE_H264CBR;
channel.rate.mode = I6C_VENC_RATEMODE_H264CBR;
channel.rate.h264Cbr = (i6c_venc_rate_h26xcbr){ .gop = config->gop,
.statTime = 1, .fpsNum = config->framerate, .fpsDen = 1, .bitrate =
(unsigned int)(config->bitrate) << 10, .avgLvl = 1 }; break;
case HAL_VIDMODE_VBR:
channel.rate.mode = _i6c_upd_venc ? I6C_VENC_NRATEMODE_H264VBR : I6C_VENC_RATEMODE_H264VBR;
channel.rate.mode = I6C_VENC_RATEMODE_H264VBR;
channel.rate.h264Vbr = (i6c_venc_rate_h26xvbr){ .gop = config->gop,
.statTime = 1, .fpsNum = config->framerate, .fpsDen = 1, .maxBitrate =
(unsigned int)(MAX(config->bitrate, config->maxBitrate)) << 10,
.maxQual = config->maxQual, .minQual = config->minQual }; break;
case HAL_VIDMODE_QP:
channel.rate.mode = _i6c_upd_venc ? I6C_VENC_NRATEMODE_H264QP : I6C_VENC_RATEMODE_H264QP;
channel.rate.mode = I6C_VENC_RATEMODE_H264QP;
channel.rate.h264Qp = (i6c_venc_rate_h26xqp){ .gop = config->gop,
.fpsNum = config->framerate, .fpsDen = 1, .interQual = config->maxQual,
.predQual = config->minQual }; break;
case HAL_VIDMODE_ABR:
channel.rate.mode = _i6c_upd_venc ? I6C_VENC_NRATEMODE_H264ABR : I6C_VENC_RATEMODE_H264ABR;
channel.rate.mode = I6C_VENC_RATEMODE_H264ABR;
channel.rate.h264Abr = (i6c_venc_rate_h26xabr){ .gop = config->gop,
.statTime = 1, .fpsNum = config->framerate, .fpsDen = 1,
.avgBitrate = (unsigned int)(config->bitrate) << 10,
.maxBitrate = (unsigned int)(config->maxBitrate) << 10 }; break;
case HAL_VIDMODE_AVBR:
channel.rate.mode = _i6c_upd_venc ? I6C_VENC_NRATEMODE_H264AVBR : I6C_VENC_RATEMODE_H264AVBR;
channel.rate.mode = I6C_VENC_RATEMODE_H264AVBR;
channel.rate.h264Avbr = (i6c_venc_rate_h26xvbr){ .gop = config->gop,
.statTime = 1, .fpsNum = config->framerate, .fpsDen = 1, .maxBitrate =
(unsigned int)(MAX(config->bitrate, config->maxBitrate)) << 10,
Expand Down Expand Up @@ -941,8 +939,6 @@ int i6c_system_init(void)
return ret;
printf("App built with headers v%s\n", I6C_SYS_API);
puts(version.version);
if (strstr(version.version, "build_time.2023"))
_i6c_upd_venc = 1;
}

return EXIT_SUCCESS;
Expand Down
18 changes: 0 additions & 18 deletions src/hal/sstar/i6c_venc.h
Original file line number Diff line number Diff line change
Expand Up @@ -53,24 +53,6 @@ typedef enum {
I6C_VENC_SRC_CONF_END
} i6c_venc_src_conf;

enum {
I6C_VENC_NRATEMODE_H264CBR = 1,
I6C_VENC_NRATEMODE_H264VBR,
I6C_VENC_NRATEMODE_H264ABR,
I6C_VENC_NRATEMODE_H264UBR,
I6C_VENC_NRATEMODE_H264QP,
I6C_VENC_NRATEMODE_H264AVBR,
I6C_VENC_NRATEMODE_MJPGCBR,
I6C_VENC_NRATEMODE_MJPGVBR,
I6C_VENC_NRATEMODE_MJPGQP,
I6C_VENC_NRATEMODE_H265CBR,
I6C_VENC_NRATEMODE_H265VBR,
I6C_VENC_NRATEMODE_H265UBR,
I6C_VENC_NRATEMODE_H265QP,
I6C_VENC_NRATEMODE_H265AVBR,
I6C_VENC_NRATEMODE_END
};

typedef enum {
I6C_VENC_RATEMODE_H264CBR = 1,
I6C_VENC_RATEMODE_H264VBR,
Expand Down
26 changes: 11 additions & 15 deletions src/hal/sstar/i6f_hal.c
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,6 @@ i6f_snr_pad _i6f_snr_pad;
i6f_snr_plane _i6f_snr_plane;
char _i6f_snr_framerate, _i6f_snr_hdr, _i6f_snr_index, _i6f_snr_profile;

char _i6f_upd_venc = 0;

char _i6f_aud_chn = 0;
char _i6f_aud_dev = 0;
char _i6f_isp_chn = 0;
Expand Down Expand Up @@ -479,14 +477,14 @@ int i6f_video_create(char index, hal_vidconfig *config)
channel.attrib.codec = I6F_VENC_CODEC_MJPG;
switch (config->mode) {
case HAL_VIDMODE_CBR:
channel.rate.mode = _i6f_upd_venc ? I6F_VENC_NRATEMODE_MJPGCBR : I6F_VENC_RATEMODE_MJPGCBR;
channel.rate.mode = I6F_VENC_RATEMODE_MJPGCBR;
channel.rate.mjpgCbr.bitrate = config->bitrate << 10;
channel.rate.mjpgCbr.fpsNum =
config->codec == HAL_VIDCODEC_JPG ? 1 : config->framerate;
channel.rate.mjpgCbr.fpsDen = 1;
break;
case HAL_VIDMODE_QP:
channel.rate.mode = _i6f_upd_venc ? I6F_VENC_NRATEMODE_MJPGQP : I6F_VENC_RATEMODE_MJPGQP;
channel.rate.mode = I6F_VENC_RATEMODE_MJPGQP;
channel.rate.mjpgQp.fpsNum = config->framerate;
channel.rate.mjpgQp.fpsDen =
config->codec == HAL_VIDCODEC_JPG ? 1 : config->framerate;
Expand All @@ -510,25 +508,25 @@ int i6f_video_create(char index, hal_vidconfig *config)
attrib = &channel.attrib.h265;
switch (config->mode) {
case HAL_VIDMODE_CBR:
channel.rate.mode = _i6f_upd_venc ? I6F_VENC_NRATEMODE_H265CBR : I6F_VENC_RATEMODE_H265CBR;
channel.rate.mode = I6F_VENC_RATEMODE_H265CBR;
channel.rate.h265Cbr = (i6f_venc_rate_h26xcbr){ .gop = config->gop,
.statTime = 1, .fpsNum = config->framerate, .fpsDen = 1, .bitrate =
(unsigned int)(config->bitrate) << 10, .avgLvl = 1 }; break;
case HAL_VIDMODE_VBR:
channel.rate.mode = _i6f_upd_venc ? I6F_VENC_NRATEMODE_H265VBR : I6F_VENC_RATEMODE_H265VBR;
channel.rate.mode = I6F_VENC_RATEMODE_H265VBR;
channel.rate.h265Vbr = (i6f_venc_rate_h26xvbr){ .gop = config->gop,
.statTime = 1, .fpsNum = config->framerate, .fpsDen = 1, .maxBitrate =
(unsigned int)(MAX(config->bitrate, config->maxBitrate)) << 10,
.maxQual = config->maxQual, .minQual = config->minQual }; break;
case HAL_VIDMODE_QP:
channel.rate.mode = _i6f_upd_venc ? I6F_VENC_NRATEMODE_H265QP : I6F_VENC_RATEMODE_H265QP;
channel.rate.mode = I6F_VENC_RATEMODE_H265QP;
channel.rate.h265Qp = (i6f_venc_rate_h26xqp){ .gop = config->gop,
.fpsNum = config->framerate, .fpsDen = 1, .interQual = config->maxQual,
.predQual = config->minQual }; break;
case HAL_VIDMODE_ABR:
I6F_ERROR("H.265 encoder does not support ABR mode!");
case HAL_VIDMODE_AVBR:
channel.rate.mode = _i6f_upd_venc ? I6F_VENC_NRATEMODE_H265AVBR : I6F_VENC_RATEMODE_H265AVBR;
channel.rate.mode = I6F_VENC_RATEMODE_H265AVBR;
channel.rate.h265Avbr = (i6f_venc_rate_h26xvbr){ .gop = config->gop,
.statTime = 1, .fpsNum = config->framerate, .fpsDen = 1, .maxBitrate =
(unsigned int)(MAX(config->bitrate, config->maxBitrate)) << 10,
Expand All @@ -541,29 +539,29 @@ int i6f_video_create(char index, hal_vidconfig *config)
attrib = &channel.attrib.h264;
switch (config->mode) {
case HAL_VIDMODE_CBR:
channel.rate.mode = _i6f_upd_venc ? I6F_VENC_NRATEMODE_H264CBR : I6F_VENC_RATEMODE_H264CBR;
channel.rate.mode = I6F_VENC_RATEMODE_H264CBR;
channel.rate.h264Cbr = (i6f_venc_rate_h26xcbr){ .gop = config->gop,
.statTime = 1, .fpsNum = config->framerate, .fpsDen = 1, .bitrate =
(unsigned int)(config->bitrate) << 10, .avgLvl = 1 }; break;
case HAL_VIDMODE_VBR:
channel.rate.mode = _i6f_upd_venc ? I6F_VENC_NRATEMODE_H264VBR : I6F_VENC_RATEMODE_H264VBR;
channel.rate.mode = I6F_VENC_RATEMODE_H264VBR;
channel.rate.h264Vbr = (i6f_venc_rate_h26xvbr){ .gop = config->gop,
.statTime = 1, .fpsNum = config->framerate, .fpsDen = 1, .maxBitrate =
(unsigned int)(MAX(config->bitrate, config->maxBitrate)) << 10,
.maxQual = config->maxQual, .minQual = config->minQual }; break;
case HAL_VIDMODE_QP:
channel.rate.mode = _i6f_upd_venc ? I6F_VENC_NRATEMODE_H264QP : I6F_VENC_RATEMODE_H264QP;
channel.rate.mode = I6F_VENC_RATEMODE_H264QP;
channel.rate.h264Qp = (i6f_venc_rate_h26xqp){ .gop = config->gop,
.fpsNum = config->framerate, .fpsDen = 1, .interQual = config->maxQual,
.predQual = config->minQual }; break;
case HAL_VIDMODE_ABR:
channel.rate.mode = _i6f_upd_venc ? I6F_VENC_NRATEMODE_H264ABR : I6F_VENC_RATEMODE_H264ABR;
channel.rate.mode = I6F_VENC_RATEMODE_H264ABR;
channel.rate.h264Abr = (i6f_venc_rate_h26xabr){ .gop = config->gop,
.statTime = 1, .fpsNum = config->framerate, .fpsDen = 1,
.avgBitrate = (unsigned int)(config->bitrate) << 10,
.maxBitrate = (unsigned int)(config->maxBitrate) << 10 }; break;
case HAL_VIDMODE_AVBR:
channel.rate.mode = _i6f_upd_venc ? I6F_VENC_NRATEMODE_H264AVBR : I6F_VENC_RATEMODE_H265AVBR;
channel.rate.mode = I6F_VENC_RATEMODE_H265AVBR;
channel.rate.h265Avbr = (i6f_venc_rate_h26xvbr){ .gop = config->gop,
.statTime = 1, .fpsNum = config->framerate, .fpsDen = 1, .maxBitrate =
(unsigned int)(MAX(config->bitrate, config->maxBitrate)) << 10,
Expand Down Expand Up @@ -900,8 +898,6 @@ int i6f_system_init(void)
return ret;
printf("App built with headers v%s\n", I6F_SYS_API);
puts(version.version);
if (strstr(version.version, "build_time.2023"))
_i6f_upd_venc = 1;
}

return EXIT_SUCCESS;
Expand Down
17 changes: 0 additions & 17 deletions src/hal/sstar/i6f_venc.h
Original file line number Diff line number Diff line change
Expand Up @@ -52,23 +52,6 @@ typedef enum {
I6F_VENC_SRC_CONF_END
} i6f_venc_src_conf;

enum {
I6F_VENC_NRATEMODE_H264CBR = 1,
I6F_VENC_NRATEMODE_H264VBR,
I6F_VENC_NRATEMODE_H264ABR,
I6F_VENC_NRATEMODE_H264UBR,
I6F_VENC_NRATEMODE_H264QP,
I6F_VENC_NRATEMODE_H264AVBR,
I6F_VENC_NRATEMODE_MJPGCBR,
I6F_VENC_NRATEMODE_MJPGQP,
I6F_VENC_NRATEMODE_H265CBR,
I6F_VENC_NRATEMODE_H265VBR,
I6F_VENC_NRATEMODE_H265UBR,
I6F_VENC_NRATEMODE_H265QP,
I6F_VENC_NRATEMODE_H265AVBR,
I6F_VENC_NRATEMODE_END
};

typedef enum {
I6F_VENC_RATEMODE_H264CBR = 1,
I6F_VENC_RATEMODE_H264VBR,
Expand Down

0 comments on commit 6b2400c

Please sign in to comment.