[x265] [PATCH] encoder: do not use std::list

Jean-Baptiste Kempf jb at videolan.org
Wed Sep 18 13:35:39 CEST 2013


On 18 Sep, Gopu Govindaswamy wrote :
> -
> +    

whitespace issue.
> -            AccessUnit tmp;
> +           NALUnitEBSP **tmp = NULL;

Identation is off

> @@ -169,7 +169,7 @@
>   \param   accessUnitsOut      output bitstream
>   \retval                      number of encoded pictures
>   */
> -int TEncTop::encode(bool flush, const x265_picture_t* pic_in, x265_picture_t *pic_out, AccessUnit& accessUnitOut)
> +int TEncTop::encode(bool flush, const x265_picture_t* pic_in, x265_picture_t *pic_out, NALUnitEBSP **nalunits)

You fail to update the doxygen doc.

> -        accessUnit.insert(accessUnit.end(), new NALUnitEBSP(onalu));
> +        //accessUnit.insert(accessUnit.end(), new NALUnitEBSP(onalu));

Why?

>      UInt numRBSPBytes = 0;
> -    for (AccessUnit::const_iterator it = accessUnit.begin(); it != accessUnit.end(); it++)
> +    int count = 0;
> +    while (nalunits[count])

Are you sure nalunits[0] always exists?

>      {
> -        UInt numRBSPBytes_nal = (*it)->m_packetSize;
> +        UInt numRBSPBytes_nal = nalunits[count]->m_packetSize;
>  #if VERBOSE_RATE
>          printf("*** %6s numBytesInNALunit: %u\n", nalUnitTypeToString((*it)->m_nalUnitType), numRBSPBytes_nal);
>  #endif
> -        if ((*it)->m_nalUnitType != NAL_UNIT_PREFIX_SEI && (*it)->m_nalUnitType != NAL_UNIT_SUFFIX_SEI)
> +        if (nalunits[count]->m_nalUnitType != NAL_UNIT_PREFIX_SEI && nalunits[count]->m_nalUnitType != NAL_UNIT_SUFFIX_SEI)
>          {
>              numRBSPBytes += numRBSPBytes_nal;
>          }
> +        count++;
>      }

Why not keeping the for syntax here?

> +    NALUnitEBSP *nalunits[5] = { 0, 0, 0, 0, 0 };

You should make this 5 a define, so you can use it later on

>          if (pi_nal) *pi_nal = (int)nalcount;
> +        

White space

> +    NALUnitEBSP *nalunits[5] = { 0, 0, 0, 0, 0 };
> +    int numEncoded = encoder->encode(!pic_in, pic_in, pic_out, nalunits);
> +     

idem

> +            m_accessUnit[m_nalcount] = (NALUnitEBSP *)X265_MALLOC(NALUnitEBSP, 1);

Why don't you check your malloc return???

-- 
Jean-Baptiste Kempf
http://www.jbkempf.com/ - +33 672 704 734
Sent from my Electronic Device


More information about the x265-devel mailing list