mirror of
https://github.com/nyanmisaka/ffmpeg-rockchip.git
synced 2025-10-30 20:16:42 +08:00
Simplify 'if' condition statements.
Drop useless '!= 0' from 'exp != 0', replace 'exp == 0' by '!exp'. Originally committed as revision 19647 to svn://svn.ffmpeg.org/ffmpeg/trunk
This commit is contained in:
@@ -86,12 +86,12 @@ int ff_dirac_schro_queue_push_back (FfmpegDiracSchroQueue *queue, void *p_data)
|
|||||||
FfmpegDiracSchroQueueElement *p_new =
|
FfmpegDiracSchroQueueElement *p_new =
|
||||||
av_mallocz(sizeof(FfmpegDiracSchroQueueElement));
|
av_mallocz(sizeof(FfmpegDiracSchroQueueElement));
|
||||||
|
|
||||||
if (p_new == NULL)
|
if (!p_new)
|
||||||
return -1;
|
return -1;
|
||||||
|
|
||||||
p_new->data = p_data;
|
p_new->data = p_data;
|
||||||
|
|
||||||
if (queue->p_head == NULL)
|
if (!queue->p_head)
|
||||||
queue->p_head = p_new;
|
queue->p_head = p_new;
|
||||||
else
|
else
|
||||||
queue->p_tail->next = p_new;
|
queue->p_tail->next = p_new;
|
||||||
@@ -105,7 +105,7 @@ void *ff_dirac_schro_queue_pop (FfmpegDiracSchroQueue *queue)
|
|||||||
{
|
{
|
||||||
FfmpegDiracSchroQueueElement *top = queue->p_head;
|
FfmpegDiracSchroQueueElement *top = queue->p_head;
|
||||||
|
|
||||||
if (top != NULL) {
|
if (top) {
|
||||||
void *data = top->data;
|
void *data = top->data;
|
||||||
queue->p_head = queue->p_head->next;
|
queue->p_head = queue->p_head->next;
|
||||||
--queue->size;
|
--queue->size;
|
||||||
|
|||||||
@@ -141,7 +141,7 @@ static int libdirac_decode_frame(AVCodecContext *avccontext,
|
|||||||
avccontext->height);
|
avccontext->height);
|
||||||
|
|
||||||
/* allocate output buffer */
|
/* allocate output buffer */
|
||||||
if (p_dirac_params->p_out_frame_buf == NULL)
|
if (!p_dirac_params->p_out_frame_buf)
|
||||||
p_dirac_params->p_out_frame_buf = av_malloc (pict_size);
|
p_dirac_params->p_out_frame_buf = av_malloc (pict_size);
|
||||||
buffer[0] = p_dirac_params->p_out_frame_buf;
|
buffer[0] = p_dirac_params->p_out_frame_buf;
|
||||||
buffer[1] = p_dirac_params->p_out_frame_buf +
|
buffer[1] = p_dirac_params->p_out_frame_buf +
|
||||||
|
|||||||
@@ -175,7 +175,7 @@ static av_cold int libdirac_encode_init(AVCodecContext *avccontext)
|
|||||||
}
|
}
|
||||||
|
|
||||||
/* Intra-only sequence */
|
/* Intra-only sequence */
|
||||||
if (avccontext->gop_size == 0 ) {
|
if (!avccontext->gop_size) {
|
||||||
p_dirac_params->enc_ctx.enc_params.num_L1 = 0;
|
p_dirac_params->enc_ctx.enc_params.num_L1 = 0;
|
||||||
if (avccontext->coder_type == FF_CODER_TYPE_VLC)
|
if (avccontext->coder_type == FF_CODER_TYPE_VLC)
|
||||||
p_dirac_params->enc_ctx.enc_params.using_ac = 0;
|
p_dirac_params->enc_ctx.enc_params.using_ac = 0;
|
||||||
@@ -183,7 +183,7 @@ static av_cold int libdirac_encode_init(AVCodecContext *avccontext)
|
|||||||
avccontext->has_b_frames = 1;
|
avccontext->has_b_frames = 1;
|
||||||
|
|
||||||
if (avccontext->flags & CODEC_FLAG_QSCALE) {
|
if (avccontext->flags & CODEC_FLAG_QSCALE) {
|
||||||
if (avccontext->global_quality != 0) {
|
if (avccontext->global_quality) {
|
||||||
p_dirac_params->enc_ctx.enc_params.qf =
|
p_dirac_params->enc_ctx.enc_params.qf =
|
||||||
avccontext->global_quality / (FF_QP2LAMBDA*10.0);
|
avccontext->global_quality / (FF_QP2LAMBDA*10.0);
|
||||||
/* if it is not default bitrate then send target rate. */
|
/* if it is not default bitrate then send target rate. */
|
||||||
@@ -246,7 +246,7 @@ static int libdirac_encode_frame(AVCodecContext *avccontext,
|
|||||||
int go = 1;
|
int go = 1;
|
||||||
int last_frame_in_sequence = 0;
|
int last_frame_in_sequence = 0;
|
||||||
|
|
||||||
if (data == NULL) {
|
if (!data) {
|
||||||
/* push end of sequence if not already signalled */
|
/* push end of sequence if not already signalled */
|
||||||
if (!p_dirac_params->eos_signalled) {
|
if (!p_dirac_params->eos_signalled) {
|
||||||
dirac_encoder_end_sequence( p_dirac_params->p_encoder );
|
dirac_encoder_end_sequence( p_dirac_params->p_encoder );
|
||||||
@@ -358,7 +358,7 @@ static int libdirac_encode_frame(AVCodecContext *avccontext,
|
|||||||
p_next_output_frame =
|
p_next_output_frame =
|
||||||
ff_dirac_schro_queue_pop(&p_dirac_params->enc_frame_queue);
|
ff_dirac_schro_queue_pop(&p_dirac_params->enc_frame_queue);
|
||||||
|
|
||||||
if (p_next_output_frame == NULL)
|
if (!p_next_output_frame)
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
memcpy(frame, p_next_output_frame->p_encbuf, p_next_output_frame->size);
|
memcpy(frame, p_next_output_frame->p_encbuf, p_next_output_frame->size);
|
||||||
|
|||||||
@@ -196,7 +196,7 @@ static void libschroedinger_handle_first_access_unit(AVCodecContext *avccontext)
|
|||||||
avccontext->time_base.den = p_schro_params->format->frame_rate_numerator;
|
avccontext->time_base.den = p_schro_params->format->frame_rate_numerator;
|
||||||
avccontext->time_base.num = p_schro_params->format->frame_rate_denominator;
|
avccontext->time_base.num = p_schro_params->format->frame_rate_denominator;
|
||||||
|
|
||||||
if (p_schro_params->dec_pic.data[0] == NULL)
|
if (!p_schro_params->dec_pic.data[0])
|
||||||
{
|
{
|
||||||
avpicture_alloc(&p_schro_params->dec_pic,
|
avpicture_alloc(&p_schro_params->dec_pic,
|
||||||
avccontext->pix_fmt,
|
avccontext->pix_fmt,
|
||||||
@@ -226,7 +226,7 @@ static int libschroedinger_decode_frame(AVCodecContext *avccontext,
|
|||||||
*data_size = 0;
|
*data_size = 0;
|
||||||
|
|
||||||
FfmpegSchroParseContextInit (&parse_ctx, buf, buf_size);
|
FfmpegSchroParseContextInit (&parse_ctx, buf, buf_size);
|
||||||
if (buf_size == 0) {
|
if (!buf_size) {
|
||||||
if (!p_schro_params->eos_signalled) {
|
if (!p_schro_params->eos_signalled) {
|
||||||
state = schro_decoder_push_end_of_stream(decoder);
|
state = schro_decoder_push_end_of_stream(decoder);
|
||||||
p_schro_params->eos_signalled = 1;
|
p_schro_params->eos_signalled = 1;
|
||||||
@@ -300,7 +300,7 @@ static int libschroedinger_decode_frame(AVCodecContext *avccontext,
|
|||||||
/* Grab next frame to be returned from the top of the queue. */
|
/* Grab next frame to be returned from the top of the queue. */
|
||||||
frame = ff_dirac_schro_queue_pop(&p_schro_params->dec_frame_queue);
|
frame = ff_dirac_schro_queue_pop(&p_schro_params->dec_frame_queue);
|
||||||
|
|
||||||
if (frame != NULL) {
|
if (frame) {
|
||||||
memcpy (p_schro_params->dec_pic.data[0],
|
memcpy (p_schro_params->dec_pic.data[0],
|
||||||
frame->components[0].data,
|
frame->components[0].data,
|
||||||
frame->components[0].length);
|
frame->components[0].length);
|
||||||
|
|||||||
@@ -145,7 +145,7 @@ static int libschroedinger_encode_init(AVCodecContext *avccontext)
|
|||||||
|
|
||||||
avccontext->coded_frame = &p_schro_params->picture;
|
avccontext->coded_frame = &p_schro_params->picture;
|
||||||
|
|
||||||
if (avccontext->gop_size == 0){
|
if (!avccontext->gop_size) {
|
||||||
schro_encoder_setting_set_double (p_schro_params->encoder,
|
schro_encoder_setting_set_double (p_schro_params->encoder,
|
||||||
"gop_structure",
|
"gop_structure",
|
||||||
SCHRO_ENCODER_GOP_INTRA_ONLY);
|
SCHRO_ENCODER_GOP_INTRA_ONLY);
|
||||||
@@ -164,7 +164,7 @@ static int libschroedinger_encode_init(AVCodecContext *avccontext)
|
|||||||
|
|
||||||
/* FIXME - Need to handle SCHRO_ENCODER_RATE_CONTROL_LOW_DELAY. */
|
/* FIXME - Need to handle SCHRO_ENCODER_RATE_CONTROL_LOW_DELAY. */
|
||||||
if (avccontext->flags & CODEC_FLAG_QSCALE) {
|
if (avccontext->flags & CODEC_FLAG_QSCALE) {
|
||||||
if (avccontext->global_quality == 0) {
|
if (!avccontext->global_quality) {
|
||||||
/* lossless coding */
|
/* lossless coding */
|
||||||
schro_encoder_setting_set_double (p_schro_params->encoder,
|
schro_encoder_setting_set_double (p_schro_params->encoder,
|
||||||
"rate_control",
|
"rate_control",
|
||||||
@@ -366,7 +366,7 @@ static int libschroedinger_encode_frame(AVCodecContext *avccontext,
|
|||||||
p_frame_output =
|
p_frame_output =
|
||||||
ff_dirac_schro_queue_pop (&p_schro_params->enc_frame_queue);
|
ff_dirac_schro_queue_pop (&p_schro_params->enc_frame_queue);
|
||||||
|
|
||||||
if (p_frame_output == NULL)
|
if (!p_frame_output)
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
memcpy(frame, p_frame_output->p_encbuf, p_frame_output->size);
|
memcpy(frame, p_frame_output->p_encbuf, p_frame_output->size);
|
||||||
|
|||||||
Reference in New Issue
Block a user